結果
| 問題 |
No.88 次はどっちだ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-08 19:25:05 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 5,000 ms |
| コード長 | 912 bytes |
| コンパイル時間 | 2,327 ms |
| コンパイル使用メモリ | 106,976 KB |
| 実行使用メモリ | 17,792 KB |
| 最終ジャッジ日時 | 2024-10-05 08:12:22 |
| 合計ジャッジ時間 | 1,814 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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);
}
}
}