結果
問題 |
No.851 テストケース
|
ユーザー |
|
提出日時 | 2019-08-13 21:03:50 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,034 bytes |
コンパイル時間 | 25,076 ms |
コンパイル使用メモリ | 378,476 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 13:35:14 |
合計ジャッジ時間 | 12,338 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 2 |
コンパイルメッセージ
warning: unused variable: `i` --> src/main.rs:17:9 | 17 | for i in 0..count { | ^ help: if this is intentional, prefix it with an underscore: `_i` | = note: `#[warn(unused_variables)]` on by default
ソースコード
fn read<T: std::str::FromStr>() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_one<T: std::str::FromStr>() -> Option<T> { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok() } fn main() { let count: i32 = read(); let mut numbers: Vec<i32> = vec![]; for i in 0..count { let input: Option<i32> = read_one(); if input.is_none() { println!("\"assert\""); std::process::exit(0); } numbers.push(input.unwrap()); } let mut new_numbers = vec![]; for i in 0..numbers.len() { for j in 0..numbers.len() { if i == j { continue; } let n = numbers[i] + numbers[j]; if !new_numbers.contains(&n) { new_numbers.push(n); } } } new_numbers.sort_by(|a, b| b.partial_cmp(a).unwrap()); println!("{}", new_numbers[1]); }