結果
問題 | No.2208 Linear Function |
ユーザー | ixTL255 |
提出日時 | 2023-02-11 17:31:59 |
言語 | Rust (1.77.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 640 bytes |
コンパイル時間 | 892 ms |
コンパイル使用メモリ | 150,292 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-22 13:56:12 |
合計ジャッジ時間 | 1,374 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,376 KB |
コンパイルメッセージ
warning: variable does not need to be mutable --> Main.rs:12:13 | 12 | let mut l: i32 = itr.next().unwrap().parse().unwrap(); | ----^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default warning: variable does not need to be mutable --> Main.rs:13:13 | 13 | let mut r: i32 = itr.next().unwrap().parse().unwrap(); | ----^ | | | help: remove this `mut` warning: variable does not need to be mutable --> Main.rs:14:13 | 14 | let mut a: i32 = itr.next().unwrap().parse().unwrap(); | ----^ | | | help: remove this `mut` warning: variable does not need to be mutable --> Main.rs:15:13 | 15 | let mut b: i32 = itr.next().unwrap().parse().unwrap(); | ----^ | | | help: remove this `mut` warning: unused `Result` that must be used --> Main.rs:10:9 | 10 | io::stdin().read_line(&mut s); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled = note: `#[warn(unused_must_use)]` on by default warning: 5 warnings emitted
ソースコード
use std::io; fn main() { let mut s = String::new(); io::stdin().read_line(&mut s).ok(); let t: usize = s.trim().parse().unwrap(); for _ in 0..t { let mut s = String::new(); io::stdin().read_line(&mut s); let mut itr = s.trim().split_whitespace(); let mut l: i32 = itr.next().unwrap().parse().unwrap(); let mut r: i32 = itr.next().unwrap().parse().unwrap(); let mut a: i32 = itr.next().unwrap().parse().unwrap(); let mut b: i32 = itr.next().unwrap().parse().unwrap(); if a < 0 { println!("{}", a * l + b); } else { println!("{}", a * r + b); } } }