結果
問題 | No.197 手品 |
ユーザー |
|
提出日時 | 2020-04-26 15:11:19 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,456 bytes |
コンパイル時間 | 15,104 ms |
コンパイル使用メモリ | 378,832 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 07:34:18 |
合計ジャッジ時間 | 14,998 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 41 WA * 2 |
ソースコード
use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let s: Vec<char> = itr.next().unwrap().chars().collect(); let n: usize = itr.next().unwrap().parse().unwrap(); let t: Vec<char> = itr.next().unwrap().chars().collect(); if n == 0 { let u: String = s.into_iter().collect(); let v: String = t.into_iter().collect(); if u == v { println!("FAILURE"); } else { println!("SUCCESS"); } } else { let a = s .iter() .fold(0, |acc, x| if *x == 'o' { acc + 1 } else { acc }); let b = t .iter() .fold(0, |acc, x| if *x == 'o' { acc + 1 } else { acc }); if a != b { println!("SUCCESS",) } else { if a == 1 { if n == 1 && ((s[0] == 'o' && t[2] == 'o') || (s[2] == 'o' && t[0] == 'o')) { println!("SUCCESS"); } else { println!("FAILURE"); } } else if a == 2 { if n == 1 && ((s[0] == 'x' && t[2] == 'x') || (s[2] == 'x' && t[0] == 'x')) { println!("SUCCESS"); } else { println!("FAILURE"); } } else { println!("FAILURE"); } } } }