結果

問題 No.197 手品
ユーザー akichiakichi
提出日時 2017-08-26 04:03:24
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 57 ms / 1,000 ms
コード長 868 bytes
コンパイル時間 1,924 ms
コンパイル使用メモリ 103,652 KB
実行使用メモリ 25,440 KB
最終ジャッジ日時 2023-09-27 09:46:17
合計ジャッジ時間 5,875 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
21,380 KB
testcase_01 AC 52 ms
21,392 KB
testcase_02 AC 52 ms
23,456 KB
testcase_03 AC 52 ms
21,444 KB
testcase_04 AC 52 ms
21,412 KB
testcase_05 AC 52 ms
21,352 KB
testcase_06 AC 53 ms
21,308 KB
testcase_07 AC 53 ms
21,444 KB
testcase_08 AC 52 ms
21,416 KB
testcase_09 AC 50 ms
21,376 KB
testcase_10 AC 50 ms
21,384 KB
testcase_11 AC 50 ms
21,560 KB
testcase_12 AC 48 ms
21,500 KB
testcase_13 AC 51 ms
21,356 KB
testcase_14 AC 51 ms
21,288 KB
testcase_15 AC 50 ms
21,488 KB
testcase_16 AC 49 ms
19,300 KB
testcase_17 AC 52 ms
21,312 KB
testcase_18 AC 53 ms
21,348 KB
testcase_19 AC 50 ms
23,404 KB
testcase_20 AC 52 ms
19,256 KB
testcase_21 AC 52 ms
21,348 KB
testcase_22 AC 52 ms
21,336 KB
testcase_23 AC 52 ms
25,440 KB
testcase_24 AC 49 ms
21,480 KB
testcase_25 AC 51 ms
21,460 KB
testcase_26 AC 50 ms
21,344 KB
testcase_27 AC 51 ms
21,308 KB
testcase_28 AC 52 ms
21,384 KB
testcase_29 AC 51 ms
21,444 KB
testcase_30 AC 51 ms
21,348 KB
testcase_31 AC 52 ms
21,388 KB
testcase_32 AC 48 ms
23,344 KB
testcase_33 AC 49 ms
23,400 KB
testcase_34 AC 50 ms
23,444 KB
testcase_35 AC 51 ms
23,348 KB
testcase_36 AC 50 ms
21,344 KB
testcase_37 AC 50 ms
21,380 KB
testcase_38 AC 51 ms
21,352 KB
testcase_39 AC 53 ms
21,432 KB
testcase_40 AC 54 ms
21,452 KB
testcase_41 AC 53 ms
21,448 KB
testcase_42 AC 54 ms
21,292 KB
testcase_43 AC 50 ms
19,404 KB
testcase_44 AC 53 ms
21,412 KB
testcase_45 AC 55 ms
23,572 KB
testcase_46 AC 57 ms
21,540 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
class Program {
    static void Main() {
        string s0 = Console.ReadLine();
        int n = int.Parse(Console.ReadLine());
        string s1 = Console.ReadLine();
        Console.WriteLine(judge(n, s0, s1));
    }

    static string judge(int n, string s0, string s1) {
        if (n == 0 && s0 != s1) return "SUCCESS";

        int cnt0 = s0.ToCharArray().Count(x => x == 'o');
        int cnt1 = s1.ToCharArray().Count(x => x == 'o');

        if (cnt0 != cnt1) return "SUCCESS";
        if (cnt0 == 0 || cnt0 == 3) return "FAILURE";

        char only = cnt0 == 1 ? 'o' : 'x';
        if (s0[1] == only && s1[1] == only && n == 1) return "SUCCESS";
        if (s0[0] == only && s1[2] == only && n == 1) return "SUCCESS";
        if (s0[2] == only && s1[0] == only && n == 1) return "SUCCESS";
        return "FAILURE";
    }
}
0