結果
問題 |
No.2091 Shio Ramen (Easy)
|
ユーザー |
|
提出日時 | 2024-07-09 14:33:58 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 422 bytes |
コンパイル時間 | 25,594 ms |
コンパイル使用メモリ | 389,116 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-09 14:34:25 |
合計ジャッジ時間 | 27,426 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
use std::io::Read; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let n: Vec<i8> = s.split_whitespace().flat_map(str::parse).collect(); let (mut a, mut m) = (0, 11); for i in 1..=n[0] as usize { let d = (n[1] - n[i + 2]).abs(); if d <= n[2] && d < m { (a, m) = (i, d); } } println!( "{}", if a > 0 { a.to_string() } else { "Unlucky!".to_owned() } ); }