結果
| 問題 |
No.227 簡単ポーカー
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-06-08 09:17:46 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 5,000 ms |
| コード長 | 2,033 bytes |
| コンパイル時間 | 3,255 ms |
| コンパイル使用メモリ | 110,684 KB |
| 実行使用メモリ | 25,996 KB |
| 最終ジャッジ日時 | 2024-09-21 05:03:43 |
| 合計ジャッジ時間 | 4,254 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
using System.Diagnostics;
namespace yukicoder
{
class Program
{
static void Main(string[] args)
{
string[] str = Console.ReadLine().Split(' ');
int[] a = new int[5];
//数字比較用配列
int[] c = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
//入力した数字を配列に入れる
for (int i = 0; i < 5; i++)
{
int A = int.Parse(str[i]);
a[i] = A;
}
//数字がいくつあるか調べる あればカウント+1する
int count = 0;
for(int i=1;i<=13;i++)
{
for(int j=1;j<=5;j++)
{
if(a[j-1]==i)
{
count += 1;
c[i - 1] += 1;
}
}
}
int count1 = 0;
//配列に2か3以外のカウントが入っているなら0にする
//1が入っているならプラス1する
for (int i = 1; i <= 13; i++)
{
if (c[i - 1] == 1)
{
count1 += 1;
c[i - 1] = 0;
}
if (c[i - 1] == 5 || c[i - 1] == 4)
{
count = 0;
break;
}
}
int ans = count - count1;
if (ans == 5)
{
Console.WriteLine("FULL HOUSE");
}
else if (ans == 4)
{
Console.WriteLine("TWO PAIR");
}
else if (ans == 3)
{
Console.WriteLine("THREE CARD");
}
else if (ans == 2)
{
Console.WriteLine("ONE PAIR");
}
else
{
Console.WriteLine("NO HAND");
}
}
}
}