QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#744286#9627. 算术mapleKingWA 0ms3656kbC++201.6kb2024-11-13 21:26:412024-11-13 21:26:48

Judging History

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

  • [2024-11-13 21:26:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3656kb
  • [2024-11-13 21:26:41]
  • 提交

answer

#include <bits/stdc++.h>
#pragma GCC optimize(2)

// using namespace std;

using i64 = long long;
using u32 = unsigned int;
using u64 = unsigned long long;

const int mod = 998244353;

i64 qkm(i64 a, int b){
    i64 res = 1;
    while(b){
        if (b & 1) res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

void solve() {
    std::vector<int> a(101);
    int c = 0;
    for(int i = 1; i <= 9; i++){
        std::cin >> a[i];
        c += a[i];
    }
    if (c == 0){
        std::cout << "0\n";
        return;
    }
    if (a[1] <= a[2]){
        a[3] += a[1];
        a[2] -= a[1];
    }else{
        a[3] += a[2];
        a[1] -= a[2];
        a[2] = 0;
        a[3] += a[1] / 3;
        a[1] %= 3;
        if (a[1] == 1){
            for(int i = 3; i <= 9; i++){
                if (a[i]){
                    a[i]--;
                    a[i + 1]++;
                    break;
                }
            }
        }else{
            a[2]++;
        }
    }
    i64 ans = 1;
    for(int i = 2; i <= 100; i++){
        ans *= qkm(i, a[i]);
        ans %= mod;
    }
    std::cout << ans << "\n";
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    // std::cout << std::fixed << std::setprecision(10); // 固定输出精度
    int t = 1;
    std::cin >> t;

    while (t--) {
        solve();
    }
    

    return 0;
}

 // 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 10

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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
216
1
10
90
90553232
143532368

result:

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