結果
問題 |
No.634 硬貨の枚数1
|
ユーザー |
![]() |
提出日時 | 2023-01-02 21:50:53 |
言語 | Rust (1.83.0 + proconio) |
結果 |
TLE
|
実行時間 | - |
コード長 | 439 bytes |
コンパイル時間 | 12,983 ms |
コンパイル使用メモリ | 383,444 KB |
実行使用メモリ | 97,664 KB |
最終ジャッジ日時 | 2024-11-27 01:17:55 |
合計ジャッジ時間 | 155,065 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 TLE * 47 |
ソースコード
fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); let mut t: Vec<usize> = vec![1]; for i in 2.. { if i < n { t.push(t[i - 2] + i); } else { break; } } let mut ans = 3; if t.iter().any(|e| e == &n) { println!("{}", 1); return; } for i in 0..t.len() / 2 + 1 { if t.iter().any(|e| e == &(n - t[i])) { ans = 2; } } println!("{}", ans); }