QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#748116 | #9627. 算术 | cxq | WA | 0ms | 3708kb | C++20 | 1.4kb | 2024-11-14 19:24:27 | 2024-11-14 19:24:27 |
Judging History
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'