QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#504646#9107. Zayin and CountAnotherDayofSun#RE 0ms0kbC++201.2kb2024-08-04 14:26:212024-08-04 14:26:21

Judging History

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

  • [2024-08-04 14:26:21]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-08-04 14:26:21]
  • 提交

answer

#include<bits/stdc++.h>
#define ll __int128
#define For(i,j,k) for(int i=(j);i<=(k);i++)
#define foR(i,j,k) for(int i=(j);i>=(k);i--) 
#define vi vector<int>
#define pb push_back
#define pii pair<int,int> 
#define mkp make_pair
#define SZ(x) ((int)x.size())

using namespace std;
inline int read() {
	char c;int res=0;bool flag=0;
	while(c=getchar(),c<48)(c=='-')&&(flag=1);
	do res=(res<<3)+(res<<1)+(c^48);
	while(c=getchar(),c>47);
	flag&&(res=-res); return res; 
}
bool a[13],b[13];
char c[1003];
int t,l,p,q,f[13],tot,z[1003],g[13];
ll x;
int main(){
	t=read();
	while(t--){
		x=0;
		for(int i=0;i<=9;++i){
			a[i]=read();
			f[i]=0;
		}
		for(int i=0;i<=9;++i){
			b[i]=read();
		}
		p=0;
		for(int i=1;i<=9;++i){\
			if(a[i])f[i]=++p;
		}
		scanf("%s",c);
		l=strlen(c);
		if(a[0])++p;
		for(int i=0;i<l;++i){
			x=x*p+f[c[i]^'0'];
		}
		if(a[0])++x;
		q=0;
		for(int i=1;i<=9;++i){
			if(b[i])g[++q]=i;
		}
		tot=0;
		if(b[0]){
			--x;
			++q;
			while(x){
				z[++tot]=g[x%q];
				x/=q;
			}
		}
		else{
			while(x){
				if(x%q)z[++tot]=g[x%q];
				else z[++tot]=g[q];
				x-=z[tot];
				x/=q;
			}
		}
		for(;tot;--tot){
			printf("%d",z[tot]);
		}
		printf("\n");
	}
}

详细

Test #1:

score: 0
Runtime Error

input:

10000
1 0 0 0 1 1 0 0 0 1
0 0 1 0 1 1 1 1 0 0
950595954440050004054505054050
1 0 0 0 1 1 1 1 0 0
1 1 1 0 1 0 0 0 1 1
45467007076660767550460064
1 1 1 1 0 0 0 1 0 0
1 1 0 1 1 0 1 0 0 1
23373171320213300170200722
0 0 0 0 1 1 1 0 1 0
0 0 1 0 0 1 0 1 1 1
558565664666565565558468668484
1 1 0 0 1 0 1 0 1 ...

output:


result: