QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#311596 | #5236. Wersja dla profesjonalistów [A] | yz_ly | 0 | 1ms | 3804kb | C++14 | 1.6kb | 2024-01-22 15:31:23 | 2024-01-22 15:31:24 |
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')+"[CE]";
else
s2=s2+"9[CE]";
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{
sum=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: 0ms
memory: 3540kb
input:
1
output:
AE1C
result:
ok correct (length = 3)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
2
output:
AE1[AC]A2E2C
result:
ok correct (length = 13)
Test #3:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
4
output:
2[AE]1[AC]A1[1[CE]C2A]3E3[AC]A4E4C
result:
ok correct (length = 30)
Test #4:
score: 0
Accepted
time: 1ms
memory: 3528kb
input:
5
output:
2[AE1[AC]A2E]2[AC]A2[2[CE]C3A]5E5C
result:
ok correct (length = 43)
Test #5:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
6
output:
2[AE1[AC]A2E]2[AC]A2[2[CE]C3A]5E5[AC]A6E6C
result:
ok correct (length = 53)
Test #6:
score: 0
Accepted
time: 1ms
memory: 3804kb
input:
7
output:
2[2[AE]1[AC]A1[1[CE]C2A]3E]3[AC]A3[3[CE]C4A]7E7C
result:
ok correct (length = 53)
Test #7:
score: -1
Wrong Answer
time: 0ms
memory: 3544kb
input:
10
output:
2[2[AE]1[AC]A1[1[CE]C2A]3E3[AC]A4E]4[AC]A4[4[CE]C5A]9E9[AC]A9E1E10C
result:
wrong answer invalid output
Subtask #2:
score: 0
Wrong Answer
Test #16:
score: 0
Wrong Answer
time: 0ms
memory: 3768kb
input:
320
output:
2[2[2[2[2[2[2[AE]1[AC]A1[1[CE]C2A]3E3[AC]A4E]4[AC]A4[4[CE]C5A]9E]9[AC]A9[9[CE]C9A1A]9E9E1E]9[AC]9[AC]1[AC]A9[9[CE]9[CE]1[CE]C9A9A2A]9[9[CE]9[CE]1[CE]C9A9A2A]1[9[CE]9[CE]1[CE]C9A9A2A]9E9E9E9E3E]9[AC]9[AC]9[AC]9[AC]3[AC]A9[9[CE]9[CE]9[CE]9[CE]3[CE]C9A9A9A9A4A]9[9[CE]9[CE]9[CE]9[CE]3[CE]C9A9A9A9A4A]9[9...
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