結果

問題 No.2176 LRM Question 1
ユーザー pengin_2000pengin_2000
提出日時 2023-05-08 01:00:11
言語 C
(gcc 12.3.0)
結果
RE  
実行時間 -
コード長 436 bytes
コンパイル時間 1,426 ms
コンパイル使用メモリ 27,780 KB
実行使用メモリ 9,652 KB
最終ジャッジ日時 2023-08-16 10:39:28
合計ジャッジ時間 4,174 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
9,632 KB
testcase_01 AC 20 ms
9,640 KB
testcase_02 AC 41 ms
9,596 KB
testcase_03 AC 19 ms
9,588 KB
testcase_04 AC 20 ms
9,628 KB
testcase_05 AC 20 ms
9,648 KB
testcase_06 AC 20 ms
9,640 KB
testcase_07 AC 19 ms
9,644 KB
testcase_08 AC 19 ms
9,576 KB
testcase_09 AC 20 ms
9,584 KB
testcase_10 AC 37 ms
9,592 KB
testcase_11 AC 20 ms
9,596 KB
testcase_12 AC 20 ms
9,644 KB
testcase_13 AC 35 ms
9,600 KB
testcase_14 AC 42 ms
9,576 KB
testcase_15 AC 37 ms
9,592 KB
testcase_16 AC 34 ms
9,652 KB
testcase_17 AC 20 ms
9,648 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 30 ms
9,520 KB
testcase_22 AC 20 ms
9,624 KB
testcase_23 AC 27 ms
9,632 KB
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
long long int fact[1000016];
int main()
{
	long long int l, r, m;
	scanf("%lld %lld %lld", &l, &r, &m);
	long long int ans = 0;
	long long int i;
	fact[0] = 1;
	for (i = 1; i < 1000006; i++)
		fact[i] = fact[i - 1] * i % m;
	long long int v = 1;
	for (i = 0; i < l; i++)
		v = v * fact[i] % m;
	for (i = l; i < m && i <= r; i++)
	{
		v = v * fact[i] % m;
		ans += v;
		ans %= m;
	}
	printf("%lld\n", ans);
	return 0;
}
0