結果
| 問題 |
No.1904 Never giving up!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-10 16:34:59 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 614 bytes |
| コンパイル時間 | 13,750 ms |
| コンパイル使用メモリ | 385,128 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-24 10:42:59 |
| 合計ジャッジ時間 | 14,783 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
ソースコード
fn main() {
let mut n = String::new();
std::io::stdin().read_line(&mut n).ok();
let n: usize = n.trim().parse().unwrap();
let mut a = String::new();
std::io::stdin().read_line(&mut a).ok();
let a: Vec<usize> = a.trim().split_whitespace().map(|s| s.parse::<usize>().unwrap()-1).collect();
let mut cnts = vec![0usize; n];
for i in 0..n { cnts[a[i]] += 1; }
let mut result = (1..=n as u128).fold(1u128, |x, y| x * y);
for i in 0..n {
if cnts[i] > 0 {
result /= (1..=cnts[i] as u128).fold(1u128, |x, y| x * y);
}
}
println!("{}", result);
}