# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
20045 |
2016-02-25T08:51:35 Z |
suzy |
괄호 (kriii4_R) |
C++ |
|
405 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; }
}
lli C(lli k) {
lli ret=f[2*k]*inv[k]%MOD;
return ret*inv[k+1]%MOD;
}
int main() {
int n, k;
f[0]=f[1]=1;
for(lli i=2;i<=1000000;i++)
f[i]=f[i-1]*i%MOD;
for(lli i=0;i<=1000000;i++)
inv[i]=p(f[i],MOD-2);
scanf("%d %d",&n,&k);
lli res=0, t=1;
for(lli l=1;l<=n;l++) {
if(l%2) t=(t*2-C((l-1)/2)+MOD)%MOD;
else t=t*2%MOD;
}
printf("%lld",t);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
399 ms |
16708 KB |
Output is correct |
2 |
Correct |
394 ms |
16708 KB |
Output is correct |
3 |
Correct |
404 ms |
16708 KB |
Output is correct |
4 |
Correct |
402 ms |
16708 KB |
Output is correct |
5 |
Correct |
405 ms |
16708 KB |
Output is correct |
6 |
Correct |
402 ms |
16708 KB |
Output is correct |
7 |
Correct |
394 ms |
16708 KB |
Output is correct |
8 |
Correct |
400 ms |
16708 KB |
Output is correct |
9 |
Correct |
395 ms |
16708 KB |
Output is correct |
10 |
Correct |
398 ms |
16708 KB |
Output is correct |
11 |
Correct |
394 ms |
16708 KB |
Output is correct |
12 |
Correct |
402 ms |
16708 KB |
Output is correct |
13 |
Correct |
396 ms |
16708 KB |
Output is correct |
14 |
Correct |
396 ms |
16708 KB |
Output is correct |
15 |
Correct |
396 ms |
16708 KB |
Output is correct |
16 |
Correct |
396 ms |
16708 KB |
Output is correct |
17 |
Correct |
404 ms |
16708 KB |
Output is correct |
18 |
Correct |
403 ms |
16708 KB |
Output is correct |
19 |
Correct |
398 ms |
16708 KB |
Output is correct |
20 |
Correct |
403 ms |
16708 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
399 ms |
16708 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |