結果

問題 No.88 次はどっちだ
ユーザー chankou0920chankou0920
提出日時 2018-03-08 19:25:05
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 912 bytes
コンパイル時間 3,834 ms
コンパイル使用メモリ 109,312 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2024-04-15 12:19:44
合計ジャッジ時間 3,798 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
17,664 KB
testcase_01 AC 24 ms
17,792 KB
testcase_02 AC 24 ms
17,664 KB
testcase_03 AC 24 ms
17,664 KB
testcase_04 AC 25 ms
17,792 KB
testcase_05 AC 26 ms
17,408 KB
testcase_06 AC 25 ms
17,536 KB
testcase_07 AC 24 ms
17,536 KB
testcase_08 AC 24 ms
17,536 KB
testcase_09 AC 25 ms
17,536 KB
testcase_10 AC 25 ms
17,920 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Program {
	// 文字の出現回数をカウントする
	public static int CountChar (string s, char c) {
		string replStr = s.Replace(c.ToString(), "");
		return s.Length - replStr.Length;
	}
	
	public static void Main () {
		const int LENGTH = 8;
		const char BLACK = 'b';
		const char WHITE = 'w';
		const string ODA = "oda";
		const string YUKIKO = "yukiko";
		
		// 先手後手を決める
		string firstPlayer = Console.ReadLine();
		string secondPlayer;
		if (firstPlayer == ODA) {
			secondPlayer = YUKIKO;
		} else {
			secondPlayer = ODA;
		}
		
		// 盤面に置いてある石の数を数える
		int count = 0;
		for (int i = 0; i < LENGTH; i++) {
			string s = Console.ReadLine();
			count += CountChar(s, BLACK);
			count += CountChar(s, WHITE);
		}
		
		if (count % 2 == 0) {
			Console.WriteLine(firstPlayer);
		} else {
			Console.WriteLine(secondPlayer);
		}
	}
}
0