QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#221901#7606. Digital Nimucup-team180#Compile Error//C++171.3kb2023-10-21 14:59:552023-10-21 14:59:55

Judging History

你现在查看的是最新测评结果

  • [2023-10-21 14:59:55]
  • 评测
  • [2023-10-21 14:59:55]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
short dp[18][163][1 << 16];
int main(){
  for (int i = 0; i < 18; i++){
    for (int j = 0; j < 163; j++){
      for (int k = 0; k < (1 << 16); k++){
        dp[i][j][k] = 0;
      }
    }
  }
  for (int i = 0; i < 163; i++){
    for (int j = 0; j < (1 << 16); j++){
      int j2 = (j << 1) & ((1 << 16) - 1);
      for (int k = 0; k < (i + 1) / 10; k++){
        if ((j >> k & 1) == 0){
          j2 |= 1;
        }
      }
      dp[1][i][j] = j2;
    }
  }
  for (int i = 2; i < 18; i++){
    for (int j = 0; j < 163 - 9; j++){
      for (int k = 0; k < (1 << 16)); k++){
        int p = j;
        for (int l = 0; l < 10; l++){
          p = dp[i - 1][j + l][p];
        }
        dp[i][j][k] = p;
      }
    }
  }
  int t;
  cin >> t;
  for (int i = 0; i < t; i++){
    long long n;
    cin >> n;
    if (n % 10 != 0){
      cout << "Algosia" << endl;
    } else {
      string s = to_string(n);
      int L = s.size();
      int dsum = 0, p = (1 << 16) - 2;
      for (int j = L - 1; j >= 1; j--){
        int d = s[L - 1 - j] - '0';
        for (int k = 0; k < d; k++){
          p = dp[j][dsum][p];
          dsum++;
        }
      }
      if ((p & 1) == 0){
        cout << "Bajtek" << endl;
      } else {
        cout << "Algosia" << endl;
      }
    }
  }
}

Details

answer.code: In function ‘int main()’:
answer.code:25:36: error: expected ‘;’ before ‘)’ token
   25 |       for (int k = 0; k < (1 << 16)); k++){
      |                                    ^
      |                                    ;
answer.code:25:39: error: ‘k’ was not declared in this scope
   25 |       for (int k = 0; k < (1 << 16)); k++){
      |                                       ^