This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,i,j,ii,jj,zx,xc,X,p[1009],pi,t,tes;
char ch[1009][1009];
int main(){
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>X;
for(i=0; i<=1000; i++){
for(j=0; j<=1000; j++){
ch[i][j]='r';
}
}
while(X>1){
if(X%2==0){
pi++;
p[pi]=2;
X/=2;
}else{
pi++;
p[pi]=1;
X=(X+1)/2;
}
}
for(i=1; i<=pi/2; i++) swap(p[i],p[pi-i+1]);
/*cout<<pi<<endl;
for(i=1; i<=pi; i++){
cout<<p[i]<<" ";
}
return 0;*/
for(t=1; t<=pi; t++){
if(p[t]==1){
for(i=1; i<t; i++){
j=t+1-i;
ch[i][j]='X';
}
ch[t][1]='d';
}else{
for(i=1; i<=t; i++){
j=t+1-i;
ch[i][j]='X';
}
}
}
a=pi+2;b=pi+2;
for(i=1; i<=a; i++) ch[i][b]='d';
ch[a][b]='.';
cout<<a<<" "<<b<<endl;
for(i=1; i<=a; i++){
for(j=1; j<=b; j++){
cout<<ch[i][j];
}
if(i!=a) cout<<endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |