QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#789532 | #9627. 算术 | Godwang# | WA | 2ms | 3696kb | C++23 | 1.7kb | 2024-11-27 20:43:53 | 2024-11-27 20:43:53 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define endl '\n'
#define ll long long
#define pb push_back
const int N=1e6+10;
const ll mod1=998244353ll;
//////////////////
ll a[100];
/////////////////
/////////////////
void init()
{
}
/////////////////
int main()
{
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//freopen("ain.txt","r",stdin);freopen("aout.txt","w",stdout);
int tt;
cin>>tt;
while (tt--)
{
priority_queue<ll,vector<ll > ,greater<ll> > q;
rep(i,1,9)
{
cin>>a[i];
}
ll minn=min(a[1],a[2]);
a[1]-=minn;
a[2]-=minn;
ll ans=1;
rep(i,1,minn)
{
ans*=3ll;
ans%=mod1;
}
if(a[1]==4)
{
ans*=4ll;
ans%=mod1;
a[1]=0;
}
rep(i,1,a[1]/3)
{
ans*=3ll;
ans%=mod1;
}
a[1]%=3;
if(a[1]==1)
{
rep(i,2,9)
{
if(a[i])
{
a[i]--;
ans*=1ll*i+1;
ans%=mod1;
a[1]=0;
break;
}
}
}
else if(a[1]==2)
{
a[1]=0;
ans*=2ll;
ans%=mod1;
}
rep(i,2,9)
{
rep(j,1,a[i])
{
ans*=1ll*i;
ans%=mod1;
}
}
cout<<ans<<endl;
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3696kb
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 90 90553232 143532368
result:
ok 7 lines
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3564kb
input:
1000 22 80 50 23 35 71 81 70 96 40 33 36 2 51 52 96 5 32 56 35 85 13 58 80 26 14 31 60 21 8 19 79 5 94 44 33 85 55 10 59 76 98 28 22 69 14 72 40 14 100 68 5 18 69 95 42 51 0 32 97 37 34 85 54 33 18 40 34 10 72 72 68 81 47 80 23 23 68 40 3 71 58 7 36 79 89 83 5 68 16 30 3 82 79 35 28 30 55 88 17 86 2...
output:
376701872 321820208 765709043 819408880 639261805 521201354 7172464 780360907 240853384 151457742 298466126 416189734 124742738 161566750 493291429 481038778 409158325 951979430 783007793 438976523 440485591 163247072 78098984 275527515 308024444 168349368 423889166 168234582 827159852 914298923 465...
result:
wrong answer 530th lines differ - expected: '144902872', found: '634968619'