結果
| 問題 | No.3394 Big Binom |
| コンテスト | |
| ユーザー |
pengin_2000
|
| 提出日時 | 2025-12-01 00:36:26 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 525 bytes |
| 記録 | |
| コンパイル時間 | 185 ms |
| コンパイル使用メモリ | 27,212 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2025-12-01 00:36:41 |
| 合計ジャッジ時間 | 13,417 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 TLE * 2 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:13:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%lld %lld", &n, &k);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
long long int modpow(long long int a, long long int n, long long int p)
{
long long int res = 1;
for (; n > 0; n /= 2, a = a * a % p)
if (n % 2 > 0)
res = res * a % p;
return res;
}
int main()
{
long long int n, k;
scanf("%lld %lld", &n, &k);
if (k > n - k)
k = n - k;
const long long int p = 998244353;
long long int i, ans = 1, b = 1;
for (i = 0; i < k; i++)
{
ans = ans * (n - i) % p;
b = b * (i + 1) % p;
}
ans = ans * modpow(b, p - 2, p) % p;
printf("%lld\n", ans);
return 0;
}
pengin_2000