# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
22688 | | PurpleNoon backward compatibility (#40) | Fully Generate (KRIII5_FG) | C++98 | | 0 ms | 626896 KiB |
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<stdio.h>
long long int b[80000000];
long long int cnt=1,bb[100000],t=0,j;
long long int asd(long long int i,long long int y){
t=0; cnt=1;
while(y!=0){t++; bb[t]=y%2; y/=2;}
for(j=t;j>=1;j--){
if(bb[j]==1) cnt*=i;
cnt%=1000000007;
if(j!=1) cnt*=cnt;
cnt%=1000000007;
}
return cnt;
}
int main(){
long long int n,i,x,y,t,f=0,cnt=0,count=0;
scanf("%lld",&n);
t=1;
if(n==1){printf("1"); return 0;}
x=1; y=1;
cnt=1;
while(t<=n){
x++;
if(f%2==0) y++;
t+=x*y;
f++;
cnt+=y;
}
t-=(x*y);
cnt-=y;
count=1;
for(i=cnt;i>=1;i--) {count*=i; count%=1000000007;b[i]=count;}
long long int xx=1,ccount=1,yy=1,flag=0;
while(xx<=cnt){
flag++;
ccount*=b[xx];
ccount%=1000000007;
if(flag%2==0) yy++;
xx+=yy;
}
n-=t;
i=cnt+1;
while(1){
if(n<=0) break;
if(n>x) ccount*=asd(i,x); else ccount*=asd(i,n);
ccount%=1000000007;
n-=x;
i++;
}
printf("%lld",ccount);
return 0;
}
Compilation message (stderr)
FG.cpp: In function 'int main()':
FG.cpp:17:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld",&n);
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |