結果

問題 No.908 うしたぷにきあくん文字列
ユーザー shinozakishinozaki
提出日時 2019-11-04 16:56:49
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 704 bytes
コンパイル時間 689 ms
コンパイル使用メモリ 142,316 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-13 02:00:03
合計ジャッジ時間 1,494 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 1 ms
4,352 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 WA -
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,352 KB
testcase_15 AC 1 ms
4,352 KB
testcase_16 AC 1 ms
4,352 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unnecessary parentheses around `if` condition
  --> 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
  --> 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
  --> 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
  --> 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
 --> Main.rs:6:9
  |
6 |     let mut s = s.split("");
  |         ----^
  |         |
  |         help: remove this `mut`
  |
  = note: `#[warn(unused_mut)]` on by default

warning: 5 warnings emitted

ソースコード

diff #

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"); }
}
0