結果
| 問題 |
No.264 じゃんけん
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-02 02:26:01 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 706 bytes |
| コンパイル時間 | 12,160 ms |
| コンパイル使用メモリ | 403,908 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-21 06:17:02 |
| 合計ジャッジ時間 | 12,994 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 6 |
コンパイルメッセージ
warning: value assigned to `ans` is never read
--> src/main.rs:19:13
|
19 | let mut ans = String::new();
| ^^^
|
= help: maybe it is overwritten before being read?
= note: `#[warn(unused_assignments)]` on by default
warning: value assigned to `ans` is never read
--> src/main.rs:20:19
|
20 | if a-b == 0 { ans = String::from("Drew"); }
| ^^^
|
= help: maybe it is overwritten before being read?
warning: value assigned to `ans` is never read
--> src/main.rs:21:20
|
21 | if a-b == -2 { ans = String::from("Lose"); }
| ^^^
|
= help: maybe it is overwritten before being read?
ソースコード
use std::io::*;
use std::str::FromStr;
fn read<T: FromStr>() -> T {
let stdin = stdin();
let stdin = stdin.lock();
let token: String = stdin
.bytes()
.map(|c| c.expect("failed to read char") as char)
.skip_while(|c| c.is_whitespace())
.take_while(|c| !c.is_whitespace())
.collect();
token.parse().ok().expect("failed to parse token")
}
fn main() {
let a: i64 = read(); // (*)
let b: i64 = read();
let mut ans = String::new();
if a-b == 0 { ans = String::from("Drew"); }
if a-b == -2 { ans = String::from("Lose"); }
if a-b == 1 { ans = String::from("Lose"); }
else {ans = String::from("Won");}
println!("{}", ans);
}