結果

問題 No.653 E869120 and Lucky Numbers
ユーザー phsplsphspls
提出日時 2022-12-25 14:23:26
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 850 bytes
コンパイル時間 19,676 ms
コンパイル使用メモリ 383,808 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-29 20:04:05
合計ジャッジ時間 14,404 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 WA -
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 0 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 0 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused import: `std::collections::VecDeque`
 --> src/main.rs:1:5
  |
1 | use std::collections::VecDeque;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

ソースコード

diff #

use std::collections::VecDeque;


fn main() {
    let mut p = String::new();
    std::io::stdin().read_line(&mut p).ok();
    let p = p.trim().chars().map(|c| c as usize - '0' as usize).collect::<Vec<_>>();

    if p.len() == 1 {
        println!("No");
        return;
    } else if p.len() == 2 {
        if p[1] == 2 || p[1] == 3 || p[1] == 4 {
            if p[0] == 1 || p[0] == 7 || p[0] == 8 {
                println!("Yes");
                return;
            }
        }
    } else {
        let n = p.len()-1;
        if p[n] == 2 || p[n] == 3 || p[n] == 4 {
            if p[0] == 1 || p[0] == 7 || p[0] == 8 {
                if n-1 == (1..n).filter(|&i| p[i] == 3 || p[i] == 4 || p[i] == 5).count() {
                    println!("Yes");
                    return;
                }
            }
        }
    }
    println!("No");
}
0