using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public abstract class Hand : IComparable
{
public abstract String SuperiorName{ get; }
public int CompareTo(object other)
{
String otherName = other.ToString();
if (otherName == this.ToString())
return 0;
else if (otherName == this.SuperiorName)
return -1;
else
return 1;
}
}
public class Gu : Hand
{
override public String SuperiorName{ get { return "パー"; } }
override public String ToString(){ return "グー"; }
}
public class Choki : Hand
{
override public String SuperiorName{ get { return "グー"; } }
override public String ToString(){ return "チョキ"; }
}
public class Pa : Hand
{
override public String SuperiorName{ get { return "チョキ"; } }
override public String ToString(){ return "パー"; }
}
public class Test
{
public static void Main()
{
int numOfPlayers;
if (!Int32.TryParse(Console.ReadLine(), out numOfPlayers))
{
numOfPlayers = 2;
}
int numOfMatches;
if (!Int32.TryParse(Console.ReadLine(), out numOfMatches))
{
numOfMatches = 3;
}
var availableHands = new Hand[]{new Gu(), new Choki(), new Pa()};
for (int cnt = 0; cnt < numOfMatches; cnt++) {
var players = new Hand[numOfPlayers];
for (int i = 0; i < numOfPlayers; i++) {
var player
= availableHands
[rand.
Next(3)]; Console.WriteLine($"プレーヤー{i + 1}:{player}");
players[i] = player;
}
if (new HashSet<Hand>(players).Count != 2)
{
Console.WriteLine("引き分けです");
}
else
{
var winner = players.Max();
var winnerIndices = new List<string>();
for (int idx = 0; idx < numOfPlayers; idx++)
{
if (players[idx] == winner)
{
winnerIndices.Add((idx + 1).ToString());
}
}
Console.WriteLine($"プレイヤー{String.Join(", ", winnerIndices)}の勝ちです");
}
Console.WriteLine();
}
}
}