QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#21499 | #2850. 蛋糕 | WhybullYMe# | AC ✓ | 11ms | 3760kb | C++14 | 793b | 2022-03-07 14:11:50 | 2022-05-08 03:34:03 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ri int
typedef long long ll;
const int maxn=1e5+10;
template<class T>inline bool ckmin(T &x,const T &y){return x>y?x=y,1:0;}
template<class T>inline bool ckmax(T &x,const T &y){return x<y?x=y,1:0;}
template<class T>inline void clear(T *arr,int siz,int val=0){memset(arr,val,sizeof(T)*(siz+1));}
const ll mod=2148473648;
int a[4];
ll ans[9];
void dfs(int p,int cnt,ll sum){
if(p==4){
(ans[cnt]+=sum)%=mod;
return;
}
if(a[p]==1)dfs(p+1,cnt+2,sum);
else dfs(p+1,cnt,sum*(a[p]-2)%mod),dfs(p+1,cnt+1,sum*2%mod);
}
int t_case;
int main(){
scanf("%d",&t_case);
while(t_case--){
scanf("%d%d%d%d",a,a+1,a+2,a+3);
clear(ans,8);
dfs(0,0,1);
for(ri i=0;i<9;++i)printf("%lld ",ans[i]);
printf("\n");
}
}
详细
Test #1:
score: 100
Accepted
time: 11ms
memory: 3760kb
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