結果
| 問題 | No.791 うし数列 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-05-02 09:53:58 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 472 bytes |
| コンパイル時間 | 14,444 ms |
| コンパイル使用メモリ | 388,224 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-31 13:11:47 |
| 合計ジャッジ時間 | 15,866 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 15 |
コンパイルメッセージ
warning: variable `ans` is assigned to, but never used --> src/main.rs:6:13 | 6 | let mut ans = 0; | ^^^ | = note: consider using `_ans` instead = note: `#[warn(unused_variables)]` on by default warning: value assigned to `ans` is never read --> src/main.rs:10:17 | 10 | ans = -1; | ^^^ | = 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:17:17 | 17 | ans = -1; | ^^^ | = help: maybe it is overwritten before being read?
ソースコード
fn main() {
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
let input_str = s.trim();
let mut ans = 0;
for (id, i) in input_str.chars().enumerate() {
if id == 0 {
if i != '1' {
ans = -1;
break
}
} else {
if i == '3' {
ans += 1;
} else {
ans = -1;
break;
}
}
}
}