QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#21515 | #2850. 蛋糕 | DaBenZhongXiaSongKuaiDi# | AC ✓ | 18ms | 3628kb | C++14 | 816b | 2022-03-07 14:23:03 | 2022-05-08 03:35:26 |
Judging History
answer
#include <bits/stdc++.h>
//#define int long long
#define ll long long
#define db double
#define fi first
#define se second
#define pii pair<int,int>
#define vi vector<int>
using namespace std;
const ll mod=2148473648;
long long a[5];
long long f[8][10];
int main() {
int T;
scanf("%d",&T);
while (T--) {
for (int i=1;i<=4;i++) {
scanf("%lld",&a[i]);
}
memset(f,0,sizeof(f));
f[0][0]=1;
for (int i=1;i<=4;i++) {
for (int j=0;j<=8;j++) {
if (a[i]==1) {
if (j>=2)
f[i][j]+=f[i-1][j-2],f[i][j]%=mod;
}
else {if (j>=1)
f[i][j]+=f[i-1][j-1]+f[i-1][j-1]; f[i][j]%=mod;
f[i][j]+=f[i-1][j]*(a[i]-2)%mod; f[i][j]%=mod;
}
}
}
for (int i=0;i<=8;i++) cout<<f[4][i]%mod<<' ';
cout<<'\n';
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 18ms
memory: 3628kb
input:
9999 18429 66560 1 13694 48994 1 16287 10018 26028 52162 14916 1 30285 52396 33384 55269 65461 96967 74820 73364 55054 70162 1 1 97285 88897 39444 35439 61069 20048 35664 1 21838 22945 6244 79240 46316 82624 33318 31522 90387 93765 7568 97379 22273 74037 1255 91257 67961 28295 1 36263 20958 87638 59...
output:
0 0 278697304 483210476 394708 8 0 0 0 0 0 939058608 754824656 301172 8 0 0 0 0 0 928825136 750217032 372400 8 0 0 0 1239780156 506705424 73742516 1370608 16 0 0 0 0 1867092428 2145345144 1816812716 2484832 16 0 0 0 0 0 0 0 0 1713974672 250424 4 0 0 1222501394 1134629934 1413163092 2088456 16 ...
result:
ok 9999 lines