QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#748116#9627. 算术cxqWA 0ms3708kbC++201.4kb2024-11-14 19:24:272024-11-14 19:24:27

Judging History

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

  • [2024-11-14 19:24:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3708kb
  • [2024-11-14 19:24:27]
  • 提交

answer

// Author: TrispdTit
// Date: 2024-11-14 18:33:18
//贪睡是一剂烈性毒品
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define ll long long
using namespace std;

const int MOD = 998244353;

int add(int a, int b) {
    a += b;
    if(a >= MOD) a -= MOD;
    return a;
}

int mul(int a, int b) {
    return 1LL * a * b % MOD;
}

int sub(int a, int b) {
    a -= b;
    if(a < 0) a += MOD;
    return a;
}

int qpow(int base, int exp) {
    int res = 1;
    while(exp > 0) {
        if(exp & 1) res = mul(res, base);
        base = mul(base, base);
        exp >>= 1;
    }
    return res;
}

void solve() {
    int a[10] = {0};
    for(int i = 1; i <= 9; i++) {
        cin >> a[i];
    }

    if(a[1] < a[2]) {
        a[3] += a[1];
        a[2] -= a[1];
        a[1] = 0;
    } else {
        a[3] += a[2];
        a[1] -= a[2];
        a[2] = 0;
        a[3] += a[1] / 3;
        if(a[1] % 3 == 2) a[2]++;
        else if(a[1] % 3 == 1 && a[3] != 0) {
            a[4]++;
            a[3]--;
        }
        a[1] = 0;
    }

    int res = 1;
    for(int i = 1; i <= 9; i++) {
        if(a[i] != 0) {
            res = mul(res, qpow(i, a[i]));
        }
    }

    cout << res << "\n";
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int t = 1;
    cin >> t;
    while(t--) {
       solve();
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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
108
1
9
81
90553232
143532368

result:

wrong answer 4th lines differ - expected: '10', found: '9'