QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#311587 | #5236. Wersja dla profesjonalistów [A] | yz_ly | 0 | 1ms | 3824kb | C++14 | 1.6kb | 2024-01-22 15:29:07 | 2024-01-22 15:29:09 |
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{
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;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 1
Accepted
time: 1ms
memory: 3564kb
input:
1
output:
AE1C
result:
ok correct (length = 3)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3500kb
input:
2
output:
AE1[AC]A2E2C
result:
ok correct (length = 13)
Test #3:
score: -1
Wrong Answer
time: 0ms
memory: 3824kb
input:
4
output:
2[AE]1[AC]A1[1[AC]C2A]3E3[AC]A4E4C
result:
wrong answer incorrect path
Subtask #2:
score: 0
Wrong Answer
Test #16:
score: 0
Wrong Answer
time: 1ms
memory: 3600kb
input:
320
output:
2[2[2[2[2[2[2[AE]1[AC]A1[1[AC]C2A]3E3[AC]A4E]4[AC]A4[4[AC]C5A]9E]9[AC]A9[9[AC]C9A1A]9E9E1E]9[AC]9[AC]1[AC]A9[9[AC]9[AC]1[AC]C9A9A2A]9[9[AC]9[AC]1[AC]C9A9A2A]1[9[AC]9[AC]1[AC]C9A9A2A]9E9E9E9E3E]9[AC]9[AC]9[AC]9[AC]3[AC]A9[9[AC]9[AC]9[AC]9[AC]3[AC]C9A9A9A9A4A]9[9[AC]9[AC]9[AC]9[AC]3[AC]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