結果
| 問題 | No.227 簡単ポーカー |
| コンテスト | |
| ユーザー |
tntan
|
| 提出日時 | 2015-06-20 08:14:02 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 727 bytes |
| 記録 | |
| コンパイル時間 | 383 ms |
| コンパイル使用メモリ | 78,220 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2026-03-29 06:27:33 |
| 合計ジャッジ時間 | 893 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 7 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:15:36: warning: iteration 4 invokes undefined behavior [-Waggressive-loop-optimizations]
15 | if (a[i] == a[i + 1])
| ~~~~~~~^
main.cpp:13:27: note: within this loop
13 | for (int i = 0; i < 5; i++)
| ~~^~~
ソースコード
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int a[5],count1=0,count2=0,count3=0;
for (int i = 0; i < 5; i++)
{
cin>>a[i];
}
sort(a, a + 5);
for (int i = 0; i < 5; i++)
{
if (a[i] == a[i + 1])
{
count1++;
}
else if (a[i] < a[i + 1])
{
count2++;
}
if (a[i] == a[i + 1]&&a[i+1] == a[i + 2])
{
count3++;
}
}
if (count1 ==0)
{
cout << "NO HAND" << endl;
}
else if (count1 == 1)
{
cout << "ONE PAIR" << endl;
}
else if (count1 == 3&&count3==1)
{
cout << "FULL HOUSE" << endl;
}
else if (count1 == 2 && count2 == 2&&count3==1)
{
cout << "THREE CARD" << endl;
}
else if (count1 == 2 && count2 == 2)
{
cout << "TWO PAIR" << endl;
}
return 0;
}
tntan