QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#751000#9627. 算术Dylan114514WA 0ms3832kbC++14687b2024-11-15 16:40:062024-11-15 16:40:07

Judging History

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

  • [2024-11-15 16:40:07]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3832kb
  • [2024-11-15 16:40:06]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int main() {
  int t;
  cin >> t;
  int ans = 1;
  while (t--) {
    vector<int> a(12, 0);
    for (int i = 1; i <= 9; ++i)
      cin >> a[i];
    while (a[1] >= 2 && a[1] > a[2]) {
      a[1] -= 2, a[2]++;
    }
    for (int i = 2; i <= 9; ++i) {
      if (a[1] == 0)
        break;
      int ad = min(a[1], a[i]);
      a[1] -= ad, a[i] -= ad, a[i + 1] += ad;
    }
    for (int i = 1; i <= 10; ++i) {
      ans %= mod;
      if (a[i]) {
        for (int j = 1; j <= a[i]; ++j) {
          ans = (ans * i) % mod;
        }
      }
    }
    cout << ans << endl;
  }

  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3832kb

input:

7
5 3 0 0 0 0 0 0 0
4 1 1 1 0 0 0 0 0
1 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 2
99 88 77 66 55 44 33 22 11
100 90 80 70 60 50 40 30 20

output:

54
5832
5832
58320
5248800
754712454
-323628052

result:

wrong answer 2nd lines differ - expected: '108', found: '5832'