QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#744286 | #9627. 算术 | mapleKing | WA | 0ms | 3656kb | C++20 | 1.6kb | 2024-11-13 21:26:41 | 2024-11-13 21:26:48 |
Judging History
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'