結果
| 問題 |
No.908 うしたぷにきあくん文字列
|
| コンテスト | |
| ユーザー |
shinozaki
|
| 提出日時 | 2019-11-04 16:53:05 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 758 bytes |
| コンパイル時間 | 15,867 ms |
| コンパイル使用メモリ | 379,376 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 23:43:14 |
| 合計ジャッジ時間 | 17,050 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 WA * 8 |
コンパイルメッセージ
warning: unnecessary parentheses around `if` condition
--> src/main.rs:14:11
|
14 | if((i + 1) % 2 == 0 && s.len()-1 != i)
| ^ ^
|
= note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
|
14 - if((i + 1) % 2 == 0 && s.len()-1 != i)
14 + if (i + 1) % 2 == 0 && s.len()-1 != i
|
warning: unnecessary parentheses around `if` condition
--> src/main.rs:16:15
|
16 | if(s[i] != " ")
| ^ ^
|
help: remove these parentheses
|
16 - if(s[i] != " ")
16 + if s[i] != " "
|
warning: unnecessary parentheses around `if` condition
--> src/main.rs:24:15
|
24 | if(s[i] == " ".to_string())
| ^ ^
|
help: remove these parentheses
|
24 - if(s[i] == " ".to_string())
24 + if s[i] == " ".to_string()
|
warning: unnecessary parentheses around `if` condition
--> src/main.rs:32:7
|
32 | if(b == true){ print!("Yes"); }
| ^ ^
|
help: remove these parentheses
|
32 - if(b == true){ print!("Yes"); }
32 + if b == true { print!("Yes"); }
|
warning: variable does not need to be mutable
--> src/main.rs:7:9
|
7 | let mut s = s.split("");
| ----^
| |
| help: remove this `mut`
|
= note: `#[warn(unused_mut)]` on by default
ソースコード
use std::io;
use std;
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] == " ".to_string())
{
b = false;
print!("{}", i);
break;
}
}
}
if(b == true){ print!("Yes"); }
else { print!("No"); }
}
shinozaki