結果
| 問題 |
No.908 うしたぷにきあくん文字列
|
| コンテスト | |
| ユーザー |
shinozaki
|
| 提出日時 | 2019-11-04 16:55:03 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 704 bytes |
| コンパイル時間 | 12,620 ms |
| コンパイル使用メモリ | 377,792 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 23:44:25 |
| 合計ジャッジ時間 | 13,757 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 WA * 3 |
コンパイルメッセージ
warning: unnecessary parentheses around `if` condition
--> src/main.rs:13:11
|
13 | if((i + 1) % 2 == 0 && s.len()-1 != i)
| ^ ^
|
= note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
|
13 - if((i + 1) % 2 == 0 && s.len()-1 != i)
13 + if (i + 1) % 2 == 0 && s.len()-1 != i
|
warning: unnecessary parentheses around `if` condition
--> src/main.rs:15:15
|
15 | if(s[i] != " ")
| ^ ^
|
help: remove these parentheses
|
15 - if(s[i] != " ")
15 + if s[i] != " "
|
warning: unnecessary parentheses around `if` condition
--> src/main.rs:23:15
|
23 | if(s[i] == " ")
| ^ ^
|
help: remove these parentheses
|
23 - if(s[i] == " ")
23 + if s[i] == " "
|
warning: unnecessary parentheses around `if` condition
--> src/main.rs:30:7
|
30 | if(b == true){ print!("Yes"); }
| ^ ^
|
help: remove these parentheses
|
30 - if(b == true){ print!("Yes"); }
30 + if b == true { print!("Yes"); }
|
warning: variable does not need to be mutable
--> src/main.rs:6:9
|
6 | let mut s = s.split("");
| ----^
| |
| help: remove this `mut`
|
= note: `#[warn(unused_mut)]` on by default
ソースコード
use std::io;
fn main() {
let mut b:bool = true;
let mut s: String = String::new();
io::stdin().read_line(&mut s).expect("Failed to read line");
let mut s = s.split("");
let mut s:Vec<&str> = s.collect();
s.remove(0);
s.remove(s.len()-1);
s.remove(s.len()-2);
for i in 0..s.len()
{
if((i + 1) % 2 == 0 && s.len()-1 != i)
{
if(s[i] != " ")
{
b = false;
break;
}
}
else
{
if(s[i] == " ")
{
b = false;
break;
}
}
}
if(b == true){ print!("Yes"); }
else { print!("No"); }
}
shinozaki