結果
| 問題 | No.227 簡単ポーカー |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-20 14:35:06 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 5,000 ms |
| コード長 | 956 bytes |
| コンパイル時間 | 2,519 ms |
| コンパイル使用メモリ | 109,484 KB |
| 実行使用メモリ | 26,184 KB |
| 最終ジャッジ日時 | 2024-11-21 10:44:09 |
| 合計ジャッジ時間 | 2,088 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
コンパイルメッセージ
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 void Main(string[] args) {
string[] s = Console.ReadLine().Split(' ');
int[] card = new int[s.Length];
for (int i = 0; i < card.Length; i++) {
card[i] = int.Parse(s[i]);
}
Array.Sort(card);
int pair = 0;
int max = 1;
for (int i = 0; i < card.Length; i++) {
bool flag = false;
int count = 1;
for (int j = i + 1; j < card.Length; j++) {
if (card[i] == card[j]) {
flag = true;
count++;
i++;
} else {
break;
}
}
if (flag) {
pair++;
if (count > max) {
max = count;
}
}
}
if (max == 3 && pair == 2) {
Console.WriteLine("FULL HOUSE");
} else if (max == 3 && pair == 1) {
Console.WriteLine("THREE CARD");
} else if (max == 2 && pair == 2) {
Console.WriteLine("TWO PAIR");
} else if (max == 2 && pair == 1) {
Console.WriteLine("ONE PAIR");
} else {
Console.WriteLine("NO HAND");
}
}
}