답안 #22638

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
22638 2017-04-30T06:04:26 Z PurpleNoon backward compatibility(#974, ainch, semteo) Fully Generate (KRIII5_FG) C++
0 / 7
0 ms 13492 KB
#include<stdio.h>
int b[3000000];
long long int asd(long long int i,long long int y){
	long long int cnt=1,b[100000],t=0,j;
	while(y!=0){t++; b[t]=y%2; y/=2;}
	for(j=t;j>=1;j--){
		if(b[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

FG.cpp: In function 'int main()':
FG.cpp:16:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 12832 KB Output is correct
2 Correct 0 ms 13492 KB Output is correct
3 Correct 0 ms 13484 KB Output is correct
4 Correct 0 ms 13492 KB Output is correct
5 Correct 0 ms 12832 KB Output is correct
6 Correct 0 ms 13488 KB Output is correct
7 Correct 0 ms 13492 KB Output is correct
8 Correct 0 ms 13488 KB Output is correct
9 Correct 0 ms 13488 KB Output is correct
10 Correct 0 ms 13492 KB Output is correct
11 Incorrect 0 ms 13488 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 12832 KB Output is correct
2 Correct 0 ms 13492 KB Output is correct
3 Correct 0 ms 13484 KB Output is correct
4 Correct 0 ms 13492 KB Output is correct
5 Correct 0 ms 12832 KB Output is correct
6 Correct 0 ms 13488 KB Output is correct
7 Correct 0 ms 13492 KB Output is correct
8 Correct 0 ms 13488 KB Output is correct
9 Correct 0 ms 13488 KB Output is correct
10 Correct 0 ms 13492 KB Output is correct
11 Incorrect 0 ms 13488 KB Output isn't correct
12 Halted 0 ms 0 KB -