結果

問題 No.2176 LRM Question 1
ユーザー ixTL255ixTL255
提出日時 2023-01-06 22:18:21
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 544 bytes
コンパイル時間 4,219 ms
コンパイル使用メモリ 130,676 KB
実行使用メモリ 6,372 KB
最終ジャッジ日時 2023-08-20 15:29:24
合計ジャッジ時間 4,214 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,352 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 0 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	let mut itr = s.trim().split_whitespace();
	let l: usize = itr.next().unwrap().parse().unwrap();
	let r: usize = itr.next().unwrap().parse().unwrap();	
	let m: usize = itr.next().unwrap().parse().unwrap();	

	let fact = |x| {
		let mut y = 1;
		for i in 1..=x { y *= i; }
		y
	};

	let mut ans: usize = 0;
	for i in l..=r {
		let mut x = 1;
			for j in 1..=i { x = x % m * fact(j); }
		ans = (ans + x) % m;
		if x % m == 0 { break; }
	}

	println!("{}", ans);
}
0