# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
20063 |
2016-02-25T08:59:36 Z |
jihoon |
괄호 (kriii4_R) |
C++ |
|
0 ms |
0 KB |
#include<cstdio>
#define je 1000000007
long long seq[2000001];
long long seqw[1000001];
long long gop(long long x,long long y){
x%=je;y%=je;
x*=y;x%=je;
return x;
}
long long hap(long long x,long long y){
x%=je;y%=je;
x+=y;x%=je;
return x;
}
long long div(long long x,long long y){
x%=je;y%=je;
int left=je-2;
long long gopp=y,ret=1;
while(left){
if(left&1){
ret=gop(ret,gopp);
}
gopp=gop(gopp,gopp);
left >>= 1;
}
ret=gop(ret,x);
return ret;
}
int main(){
int n,k,su=1;
scanf("%d %d",&n,&k);
seq[1]=1;
fact[0]=1;
for(int i=1;i<=2*n;i++){
fact[i]=gop(fact[i-1],i);
}
for(int i=1;i<=n;i++){
seq[i]=gop(seq[i-1],k+1);
if(i%2){
su=gop(su,k);
seq[i]=hap(seq[i],je-gop(su,div(div(gop(fact[2*n],fact[n]),n+1),n+1)));
}
}
printf("%lld\n",seq[n]);
}
Compilation message
R.cpp: In function ‘int main()’:
R.cpp:37:5: error: ‘fact’ was not declared in this scope
fact[0]=1;
^
R.cpp:35:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d",&n,&k);
^