QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#21586#2850. 蛋糕LFCode#AC ✓10ms3788kbC++141.8kb2022-03-07 15:32:302022-05-08 03:40:11

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-08 03:40:11]
  • 评测
  • 测评结果:AC
  • 用时:10ms
  • 内存:3788kb
  • [2022-03-07 15:32:30]
  • 提交

answer

#include<bits/stdc++.h>
#include<cstdio>
#include<cctype>
#define ll long long
#define PI pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define ui ll
#define pb push_back
#define llu long long unsigned
using namespace std;
const int MB=1<<20;
struct FastIO{
	char ib[MB+100],*p,*q;
	char ob[MB+100],*r,stk[128];
	int tp;
	FastIO(){p=q=ib,r=ob,tp=0;}
	~FastIO(){fwrite(ob,1,r-ob,stdout);}
	char read_char(){if(p==q){p=ib,q=ib+fread(ib,1,MB,stdin);if(p==q)return 0;}return *p++;}
	template<typename T>
	void read_int(T& x){char c=read_char(),l=0;for(x=0;!isdigit(c);c=read_char())l=c;for(;isdigit(c);c=read_char())x=x*10-'0'+c;if(l=='-')x=-x;}
	void write_char(char c){if(r-ob==MB)r=ob,fwrite(ob,1,MB,stdout);*r++=c;}
	template<typename T>
	void write_int(T x){if(x<0)write_char('-'),x=-x;do stk[++tp]=x%10+'0';while(x/=10);while(tp)write_char(stk[tp--]);}
}IO;
//IO.read_int(a);c=IO.read_char();IO.write_int(a);//IO.write_char(c);

const ui N=10,mod=2148473648;
ui T,n,a[5],ans[N];
ui lyt(ui wz,ui now){
	ui i=now;
	ui data1=0;
			if(i==0)data1=max(0,(((int)a[wz])-2));
			if(i==1){
				if(a[wz]==1)data1=0;
				else data1=2;
			}
			if(i==2){
				if(a[wz]==1)data1=1;
				else data1=0;
			}
			return data1;
}

signed main(){
	scanf("%lld",&T);
//	T=1;
	while(T--){
		memset(ans,0,sizeof(ans));
		for(ui i=1;i<=4;i++)scanf("%lld",&a[i]);
		for(ui i=0;i<=2;i++){
			ui data1=lyt(1,i);
			for(ui o=0;o<=2;o++){
				ui data2=lyt(2,o);
				
				for(ui v=0;v<=2;v++){
					ui data3=lyt(3,v);
					for(ui j=0;j<=2;j++){
						ui data4=lyt(4,j);
						ans[i+o+v+j]+=data1*data2%mod*data3%mod*data4%mod;
					}
				}
			}
		}
		for(ui i=0;i<=8;i++)printf("%lld ",ans[i]%mod);
		printf("\n");
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 10ms
memory: 3788kb

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