QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#751004#9627. 算术Dylan114514WA 0ms3536kbC++14709b2024-11-15 16:42:142024-11-15 16:42:15

Judging History

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

  • [2024-11-15 16:42:15]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3536kb
  • [2024-11-15 16:42:14]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
using ll  = long long;
int main() {
  int t;
  cin >> t;
  ll ans = 1;
  while (t--) {
    vector<ll> 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: 3536kb

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
722083357
493938987

result:

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