Yandex.Algorithm 2020 Final D問題 - Exponential expression

Source

Yandex.Algorithm 2020 Final
終了後に提出できるコンテスト
問題文

問題概要

省略

解法

省略

cLayversion 20201102-1)のコード

C++に変換後のコードはこちら

int N;
char S[1d6+2];
int ress; char res[5d6];

void aster(void){
  res[ress++] = '*';
  res[ress++] = '*';
}

{
  int i = 0, j, val, nx, bst = 0, x, y, xy;
  int arr[12] = {0, 0, 5, 4, 3, 3, 3, 3, 3, 3, 3, 2};
  rd(S@N);
  for(;;){
    j = i;
    if(bst==0 && j+1 < N && i==j && S[i]=='1') j++;
    while(j+1 < N && S[j+1]=='0') j++;

    val = S[i] - '0';
    if(j > i) val = min(11, val * 10 + S[i+1] - '0');
    if(j > i+1) val = 11;
    if(bst) val = 11;
    while(i <= j) res[ress++] = S[i++];
    if(i >= N) break;

    bst = 1;

    if(N - i > 2) aster(), bst = 0, continue;
    if(N - i == 2){
      x = S[i] - '0';
      y = S[i+1] - '0';
      xy = max(10*x+y, pow(x,y));
      if(pow(val,xy) > pow(val*10+x, y)) aster(), bst = 0;
    }
    if(N - i == 1){
      if(arr[val] <= S[i] - '0') aster(), bst = 0;
    }
  }
  wt(res);
}

Current time: 2024年04月24日23時00分31秒
Last modified: 2020年11月08日09時16分02秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Yandex_Algorithm
トップページに戻る

Logged in as: unknown user (not login)

ログイン: