結果

問題 No.2176 LRM Question 1
コンテスト
ユーザー
提出日時 2024-07-12 22:26:03
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
WA  
実行時間 -
コード長 412 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,529 ms
コンパイル使用メモリ 185,708 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2026-03-30 12:32:12
合計ジャッジ時間 6,813 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn main() {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	let v: Vec<u64> = s.split_whitespace().flat_map(str::parse).collect();
	if v[0] >= v[2] {
		println!("0");
		return;
	}
	let (mut a, mut b, mut c) = (1, 1, 0);
	for i in 1..v[0] {
		a = a * i % v[2];
		b = b * a % v[2];
	}
	for i in v[0]..=v[2] {
		a = a * i % v[2];
		b = b * a % v[2];
		c += b;
	}
	println!("{}", c % v[2]);
}
0