結果
問題 | No.197 手品 |
ユーザー |
|
提出日時 | 2020-05-21 00:09:18 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 952 bytes |
コンパイル時間 | 12,822 ms |
コンパイル使用メモリ | 377,844 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-01 23:48:10 |
合計ジャッジ時間 | 12,418 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 40 WA * 3 |
ソースコード
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 == 0 { println!("{}", if s1.iter().zip(s2.iter()).filter(|pair| pair.0 == pair.1).count() == 3 { "SUCCESS" } else { "FAILURE" }); } else if n == 1 { if (xcount(&s1) == 1 || xcount(&s1) == 2) && s1[1] == s2[1] && s1[0] == s2[2] { println!("SUCCESS"); } else { println!("FAILURE"); } } else { println!("FAILURE"); } }