QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#311583#5236. Wersja dla profesjonalistów [A]yz_ly0 1ms3804kbC++141.6kb2024-01-22 15:26:342024-01-22 15:26:36

Judging History

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

  • [2024-01-22 15:26:36]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3804kb
  • [2024-01-22 15:26:34]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline ll read(){
	char ch=getchar();
	ll f=1,x=0;
	while(ch<'0'||ch>'9'){
		if(ch=='-')
			f=-f;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}
inline void work(int k){
	if(k<0){
		putchar('-');
		k=-k;
	}
	if(k>9)
		work(k/10);
	putchar(k%10+'0');
}
/*
当n为奇数时,可以划分为两个n/2的三角形带一个菱形
分别解决,递归即可
n为偶数时
*/
ll n;
string solve(ll n){
	string sum="";
	if(n==1){
		sum="AE";
		return sum;
	}
	int len=n/2;
	if(n&1){
		string ans=solve(n/2);
		sum+="2[";
		sum+=ans;
		sum+=']';
		int now=len;
		while(now){
			if(now<=9)
				sum=sum+char(now+'0')+"[AC]";
			else
				sum=sum+"9[AC]";
			now-=min(9,now);
		}
		sum+='A';
		string s2="";
		now=len;
		while(now){
			if(now<=9)
				s2=s2+char(now+'0')+"[AC]";
			else
				s2=s2+"9[AC]";
			now-=min(9,now);
		}
		s2+='C';
		now=len+1;
		while(now){
			if(now<=9)
				s2=s2+char(now+'0')+"A";
			else
				s2=s2+"9A";
			now-=min(9,now);
		}
		now=len;
		while(now){
			if(now<=9)
				sum=sum+char(now+'0')+'['+s2+']';
			else
				sum=sum+"9["+s2+']';
			now-=min(9,now);
		}
	}
	else{
		string ans=solve(n-1);
		int now=n-1;
		while(now){
			if(now<=9)
				sum=sum+char(now+'0')+"[AC]";
			else
				sum=sum+"9[AC]";
			now-=min(9,now);
		}
		sum+='A';
	}
	int now=n;
	while(now){
		if(now<=9)
			sum=sum+char(now+'0')+"E";
		else
			sum=sum+"9E";
		now-=min(9,now);
	}
	return sum;
}
int main(){
	n=read();
	cout<<solve(n)<<n<<"C";
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 1
Accepted
time: 1ms
memory: 3752kb

input:

1

output:

AE1C

result:

ok correct (length = 3)

Test #2:

score: -1
Wrong Answer
time: 0ms
memory: 3804kb

input:

2

output:

1[AC]A2E2C

result:

wrong answer incorrect path

Subtask #2:

score: 0
Wrong Answer

Test #16:

score: 0
Wrong Answer
time: 0ms
memory: 3608kb

input:

320

output:

9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]9[AC]4[AC]A9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E5E320C

result:

wrong answer invalid output

Subtask #3:

score: 0
Time Limit Exceeded

Test #28:

score: 0
Time Limit Exceeded

input:

1000000

output:


result:


Subtask #4:

score: 0
Time Limit Exceeded

Test #37:

score: 0
Time Limit Exceeded

input:

999999

output:


result:


Subtask #5:

score: 0
Time Limit Exceeded

Test #46:

score: 0
Time Limit Exceeded

input:

10000000000

output:


result:


Subtask #6:

score: 0
Time Limit Exceeded

Test #55:

score: 0
Time Limit Exceeded

input:

9999999999

output:


result:


Subtask #7:

score: 0
Time Limit Exceeded

Test #64:

score: 0
Time Limit Exceeded

input:

100000000000000

output:


result:


Subtask #8:

score: 0
Time Limit Exceeded

Test #84:

score: 0
Time Limit Exceeded

input:

99999999999999

output:


result:


Subtask #9:

score: 0
Time Limit Exceeded

Test #103:

score: 0
Time Limit Exceeded

input:

1000000000000000000

output:


result:


Subtask #10:

score: 0
Time Limit Exceeded

Test #128:

score: 0
Time Limit Exceeded

input:

999999999999999999

output:


result: