結果
| 問題 |
No.2208 Linear Function
|
| コンテスト | |
| ユーザー |
ixTL255
|
| 提出日時 | 2023-02-11 17:31:59 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 640 bytes |
| コンパイル時間 | 14,541 ms |
| コンパイル使用メモリ | 378,756 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-08 05:35:36 |
| 合計ジャッジ時間 | 12,731 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 |
コンパイルメッセージ
warning: variable does not need to be mutable --> src/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 --> src/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 --> src/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 --> src/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 --> src/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 help: use `let _ = ...` to ignore the resulting value | 10 | let _ = io::stdin().read_line(&mut s); | +++++++
ソースコード
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); }
}
}
ixTL255