QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#776922 | #9627. 算术 | RUOHUI | WA | 1ms | 3544kb | C++20 | 1.2kb | 2024-11-23 21:40:33 | 2024-11-23 21:40:33 |
Judging History
answer
#include "bits/stdc++.h"
#define int long long
using namespace std;
#define PII pair<int, int>
const int N = 2e6 + 10, M = 2e6 + 10, mod = 998244353, inf = 1e18;
double eps = 1e-9;
int n, m;
int ksm(int a, int k)
{
int ans = 1;
while (k)
{
if (k & 1)
ans = ans * a % mod;
a = a * a % mod;
k >>= 1;
}
return ans;
}
int a[12];
void solve()
{
for(int i=1;i<=9;i++)
{
cin>>a[i];
}
int xx=min(a[1],a[2]);
a[2]-=xx,a[3]+=xx;
a[1]-=xx;
a[3]+=a[1]/3;
a[1]%=3;
if(a[1]==2)
a[2]++;
if(a[1]==1)
{
for(int i=2;i<=9;i++)
{
if(a[i])
{
a[i+1]++;
a[i]--;
break;
}
}
}
int ans=1;
for(int i=2;i<=10;i++)
{
if(a[i])
ans*=ksm(i,a[i]);
//cout<<a[i]<<"\n";
ans%=mod;
}
cout<<ans%mod<<"\n";
}
signed main()
{
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
int T = 1;
cin >> T;
while (T--)
solve();
// cout<<round(0.5);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3544kb
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 10 900 71124023 377815858
result:
wrong answer 5th lines differ - expected: '90', found: '900'