結果

問題 No.197 手品
ユーザー phspls
提出日時 2020-05-21 00:01:46
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 800 bytes
コンパイル時間 13,465 ms
コンパイル使用メモリ 379,236 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-01 23:47:54
合計ジャッジ時間 13,723 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 38 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

fn xcount(s: &Vec<char>) -> usize {
    s.iter().filter(|c| **c == 'x').count()
}

fn main() {
    let mut s1 = String::new();
    std::io::stdin().read_line(&mut s1).ok();
    let s1: Vec<char> = s1.trim().chars().collect();
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let n: usize = n.trim().parse().unwrap();
    let mut s2 = String::new();
    std::io::stdin().read_line(&mut s2).ok();
    let s2: Vec<char> = s2.trim().chars().collect();

    if xcount(&s1) != xcount(&s2) {
        println!("SUCCESS");
    } else if n == 1 {
        if (xcount(&s1) == 1 || xcount(&s1) == 2) && (s1[0] == s2[2] || s1[2] == s2[0]) {
            println!("SUCCESS");
        } else {
            println!("FAILURE");
        }
    } else {
        println!("FAILURE");
    }
}
0