結果
問題 | No.143 豆 |
ユーザー |
![]() |
提出日時 | 2018-10-24 17:18:04 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 758 bytes |
コンパイル時間 | 12,224 ms |
コンパイル使用メモリ | 402,592 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 11:05:42 |
合計ジャッジ時間 | 12,745 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
use std::io;fn main() {let mut input1 = String::new();let mut input2 = String::new();io::stdin().read_line(&mut input1).unwrap();let mut input1 = input1.trim().split_whitespace();let k: i32 = input1.next().unwrap().parse().unwrap();let n: i32 = input1.next().unwrap().parse().unwrap();let f: u32 = input1.next().unwrap().parse().unwrap();io::stdin().read_line(&mut input2).unwrap();let mut ages = input2.trim().split_whitespace();let mut num_beans: i32 = k * n;for _ in 0..f {num_beans -= ages.next().unwrap().parse::<i32>().unwrap();if num_beans < 0 {println!("-1");return;}}println!("{}", num_beans);}