QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#793117 | #9627. 算术 | happy_lazier# | WA | 0ms | 3836kb | C++20 | 985b | 2024-11-29 16:51:12 | 2024-11-29 16:51:13 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,l,r) for(ll i=l;i<=r;++i)
#define rep_(i,r,l) for(ll i=r;i>=l;--i)
const ll N = 2e5 + 7;
const ll P = 998244353;
ll qpow(ll x, ll b) {
ll res = 1;
while (b) {
if (b & 1)res = (res * x) % P;
x = x * x % P;
b >>= 1ll;
}
return res;
}
ll inv(ll x) { return qpow(x, P - 2); }
void solve() {
vector<ll> v(2000, 0);
ll tot = 0;
rep(i, 1, 9) cin >> v[i], tot += v[i];
ll mx = min(v[1], v[2]);
v[1] -= mx;
v[2] -= mx;
v[3] += mx;
if (v[1] >= 3) {
v[3] += v[1] / 3;
v[1] %= 3;
}
if (v[1] == 1) {
rep(i, 2, 9) {
if (v[i]) {
v[i]--;
v[i + 1]++;
break;
}
}
}
else {
v[2]++;
v[1] = 0;
}
ll res = 1;
rep(i, 1, 9) {
if (!v[i])continue;
res = res * qpow(i, v[i]) % P;
}
cout << res << endl;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int T(1);
cin >> T;
while (T--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3836kb
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 1 9 90553232 143532368
result:
wrong answer 2nd lines differ - expected: '108', found: '216'