QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#745189 | #9627. 算术 | lrher# | WA | 0ms | 3876kb | C++14 | 2.1kb | 2024-11-14 08:08:44 | 2024-11-14 08:08:45 |
Judging History
answer
#include<set>
#include<map>
#include<cmath>
#include<ctime>
#include<stack>
#include<queue>
#include<deque>
#include<string>
#include<bitset>
#include<vector>
#include<cstdio>
#include<random>
#include<complex>
#include<cstdlib>
#include<climits>
#include<iomanip>
#include<cstring>
#include<cassert>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<unordered_map>
using namespace std;
// #define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
// char buf[1<<21],*p1=buf,*p2=buf;
const long long _base=107374183;
int writetemp[30];
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;
return x;
}
inline void write(unsigned long long x)
{
int tot=(x==0);
writetemp[1]=0;
while(x) writetemp[++tot]=x%10,x/=10;
while(tot) putchar(writetemp[tot--]+'0');
putchar('\n');
return ;
}
const int mod=998244353;
int T;
int a[10];
long long ans;
long long binpow(long long a,long long b)
{
long long res=1;
while(b)
{
if(b&1) res=res*a%mod;
a=a*a%mod,b>>=1;
}
return res;
}
int main()
{
// freopen("s.out","r",stdin);
// freopen("a.out","w",stdout);
scanf("%d",&T);
while(T--)
{
for(int i=1;i<=9;i++) scanf("%d",&a[i]);
int now=min(a[1],a[2]);
a[1]-=now,a[2]-=now,a[3]+=now;
a[3]+=a[1]/3,a[1]%=3;
a[2]+=a[1]/2,a[1]%=2;
ans=1;
if(a[1])
{
a[1]=0;
for(int i=2;i<=9;i++)
{
if(a[i])
{
if(i==9)
{
ans=10;
break;
}
a[i]--;
a[i+1]++;
break;
}
}
}
for(int i=1;i<=9;i++) (ans*=binpow(i,a[i]))%=mod;
printf("%lld\n",ans);
}
return 0;
}
/*
7
5 3 0 0 0 0 0 0 0
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3876kb
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 90 810 90553232 143532368
result:
wrong answer 4th lines differ - expected: '10', found: '90'