結果
| 問題 |
No.825 賢いお買い物
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-05-18 18:44:40 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 859 bytes |
| コンパイル時間 | 12,942 ms |
| コンパイル使用メモリ | 383,848 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-17 06:14:51 |
| 合計ジャッジ時間 | 14,091 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 17 WA * 2 |
コンパイルメッセージ
warning: function `read_vec2` is never used
--> src/main.rs:13:4
|
13 | fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
| ^^^^^^^^^
|
= note: `#[warn(dead_code)]` 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_vec<T: std::str::FromStr>() -> Vec<T> {
read::<String>().split_whitespace()
.map(|e| e.parse().ok().unwrap()).collect()
}
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
(0..n).map(|_| read_vec()).collect()
}
fn main() {
let v = read_vec::<u8>();
let (a, b, c) = (v[0], v[1], v[2]);
if a + b < c {
println!("Impossible");
return();
}
let sub = a + b - c;
if sub < a {
println!("{}", sub);
return();
} else if sub >= a {
println!("{}", a + 10 * (sub - a));
return();
}
}