# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
19956 |
2016-02-25T07:48:07 Z |
suzy |
괄호 (kriii4_R) |
C++14 |
|
439 ms |
16708 KB |
#include <stdio.h>
#define MOD 1000000007
typedef long long lli;
lli f[1000001];
lli inv[1000001];
lli p(lli a, lli x) {
if(x==0) return 1;
if(x%2) return a*p(a,x-1)%MOD;
else { lli m=p(a,x/2); return m*m%MOD; }
}
int main() {
int n, k;
scanf("%d %d",&n,&k);
f[0]=f[1]=1;
for(long long i=2;i<=1000000;i++)
f[i]=f[i-1]*i%MOD;
for(int i=0;i<=1000000;i++)
inv[i]=p(f[i],MOD-2);
lli res=0;
for(lli l=n/2+n%2;l<=n;l++) {
lli t=f[l]*inv[n-l]%MOD;
t=t*inv[2*l-n]%MOD;
t=t*p(k,l)%MOD;
res+=t; res%=MOD;
}
printf("%lld",res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
439 ms |
16708 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |