QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#310684 | #5236. Wersja dla profesjonalistów [A] | sumi007 | 0 | 0ms | 0kb | C++14 | 1.1kb | 2024-01-21 16:53:08 | 2024-01-21 16:53:08 |
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define ldb long double
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define lowbit(i) i&(-i)
ll n,pw9[30];
string get_str(ll k,string x){
if(k==1) return x;
string res="";
if(k<=9){
char ch = '0'+k;
res = res+ch+"["+x+"]";
}else{
res = res+"9["+get_str(k/9,x)+"]";
if(k%9) res = res+get_str(k%9,x);
}
return res;
}
string solve(ll n){
if(n==1){
return "AE";
}
if(n%2==0){
string res = solve(n-1),ex;
ex = ex+get_str(n-1,"AC")+"A"+get_str(n,"E");
res = res+ex;
return res;
}
string res = solve(n/2),ex;
res = "2["+res+"]";
ex = ex+get_str(n/2,"AC")+"A";
ex = ex+get_str(n/2,"["+get_str(n/2,"CE")+"C"+get_str((n+1)/2,"A")+"]");
ex = ex+get_str(n,"E");
res = res+ex;
return res;
}
int main(){
freopen("ans.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin >> n;
pw9[0] = 1;
for(int i=1;i<=25;i++) pw9[i] = pw9[i-1]*9ll;
string ans = solve(n);
ans = ans+get_str(n,"C");
//cout << get_str(n,"C") << '\n';
cout << ans;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Dangerous Syscalls
Test #1:
score: 0
Dangerous Syscalls
input:
1
output:
result:
Subtask #2:
score: 0
Dangerous Syscalls
Test #16:
score: 0
Dangerous Syscalls
input:
320
output:
result:
Subtask #3:
score: 0
Dangerous Syscalls
Test #28:
score: 0
Dangerous Syscalls
input:
1000000
output:
result:
Subtask #4:
score: 0
Dangerous Syscalls
Test #37:
score: 0
Dangerous Syscalls
input:
999999
output:
result:
Subtask #5:
score: 0
Dangerous Syscalls
Test #46:
score: 0
Dangerous Syscalls
input:
10000000000
output:
result:
Subtask #6:
score: 0
Dangerous Syscalls
Test #55:
score: 0
Dangerous Syscalls
input:
9999999999
output:
result:
Subtask #7:
score: 0
Dangerous Syscalls
Test #64:
score: 0
Dangerous Syscalls
input:
100000000000000
output:
result:
Subtask #8:
score: 0
Dangerous Syscalls
Test #84:
score: 0
Dangerous Syscalls
input:
99999999999999
output:
result:
Subtask #9:
score: 0
Dangerous Syscalls
Test #103:
score: 0
Dangerous Syscalls
input:
1000000000000000000
output:
result:
Subtask #10:
score: 0
Dangerous Syscalls
Test #128:
score: 0
Dangerous Syscalls
input:
999999999999999999