#include<cstdio>
int res = 1;
int i = 1;
int j = 1;
int res2 = 1;
int n= 0 , m = 0;
int gop1(int g){
for(i; i <= (g/2)+1; i++)
res = (res* i)%1000000007;
return res;
}
int gop2(int g){
i = g/2+2;
for(i; i<= g; i++){
res = (res* i)%1000000007;
}
return res;
}
int gop3(int g){
for(j ; j <=g/2; j++){
res2 = (res*m)%1000000007;
}
return res2;
}
int main(){
scanf("%d %d",&n, &m);
int num = 1;
int s = m;
for(num ; num != n; num++){
if(num%2 == 1)
s = ((m+1)*s)%1000000007 ;
else{
int x1 = gop1(num);
int x2 = gop2(num);
int x3 = gop3(num);
s = ((m+1)*s)%1000000007 - (x3*(x2/x1)%1000000007);
}
}
printf("%d", s);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
489 ms |
1080 KB |
SIGFPE Floating point exception |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |