結果

問題 No.1016 三目並べ
ユーザー tonyu0
提出日時 2020-04-03 23:09:46
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 1,023 bytes
コンパイル時間 25,259 ms
コンパイル使用メモリ 377,884 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-03 05:46:48
合計ジャッジ時間 13,738 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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 t: usize = itr.next().unwrap().parse().unwrap();
    let mut out = Vec::new();
    for _ in 0..t {
        let n: usize = itr.next().unwrap().parse().unwrap();
        let s: Vec<char> = itr.next().unwrap().chars().collect();

        let mut o = false;
        if n > 2 {
            for i in 0..n - 2 {
                if s[i] == 'o' && s[i + 1] == 'o' && s[i + 2] != 'x' {
                    o = true;
                }
                if s[i] != 'x' && s[i + 1] == 'o' && s[i + 2] == 'o' {
                    o = true;
                }
                if s[i] == 'o' && s[i + 1] != 'x' && s[i + 2] == 'o' {
                    o = true;
                }
            }
        }

        if o {
            writeln!(out, "O").ok();
        } else {
            writeln!(out, "X").ok();
        }
    }
    stdout().write_all(&out).unwrap();
}
0