結果
問題 | No.197 手品 |
ユーザー |
|
提出日時 | 2017-08-26 04:03:24 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 27 ms / 1,000 ms |
コード長 | 868 bytes |
コンパイル時間 | 894 ms |
コンパイル使用メモリ | 112,504 KB |
実行使用メモリ | 26,912 KB |
最終ジャッジ日時 | 2024-07-20 03:52:57 |
合計ジャッジ時間 | 3,341 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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"; } }