結果
| 問題 |
No.524 コインゲーム
|
| ユーザー |
hirakich1048576
|
| 提出日時 | 2016-05-04 14:36:21 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 719 bytes |
| コンパイル時間 | 595 ms |
| コンパイル使用メモリ | 21,248 KB |
| 実行使用メモリ | 11,776 KB |
| 最終ジャッジ日時 | 2024-11-28 15:19:22 |
| 合計ジャッジ時間 | 22,948 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 22 TLE * 10 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:39:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
39 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#define MOD 1000000007
typedef unsigned long long flandre;
flandre binpow(flandre a, flandre p){
flandre powing = a;
flandre result = 1;
while (p) {
if (p & 1) {
result *= powing;
result %= MOD;
}
p = p >> 1;
powing = (powing * powing) % MOD;
}
return result;
}
long solve(int n){
flandre numerator, denominator;
int i;
numerator = denominator = 1;
for (i = n + 1; i <= 2 * n; i++) {
numerator *= (flandre)i;
numerator %= MOD;
}
for (i = 1; i <= n + 1; i++) {
denominator *= (flandre)i;
denominator %= MOD;
}
return (long)((numerator * binpow(denominator, MOD - 2)) % MOD);
}
int main(void){
int n;
scanf("%d", &n);
printf("%ld\n", solve(n));
return 0;
}
hirakich1048576