結果
問題 | No.227 簡単ポーカー |
ユーザー | eri |
提出日時 | 2015-06-22 23:57:30 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 529 bytes |
コンパイル時間 | 615 ms |
コンパイル使用メモリ | 54,540 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-07 16:45:13 |
合計ジャッジ時間 | 912 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 1 ms
6,944 KB |
testcase_04 | AC | 1 ms
6,940 KB |
testcase_05 | AC | 1 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,940 KB |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | AC | 1 ms
6,944 KB |
testcase_09 | AC | 1 ms
6,940 KB |
testcase_10 | AC | 2 ms
6,944 KB |
testcase_11 | AC | 2 ms
6,940 KB |
testcase_12 | AC | 1 ms
6,944 KB |
testcase_13 | AC | 1 ms
6,940 KB |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:24: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 7 | char *s[5] = { "NO HAND", "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR" }; | ^~~~~~~~~ main.cpp:7:35: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 7 | char *s[5] = { "NO HAND", "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR" }; | ^~~~~~~~~~~~ main.cpp:7:49: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 7 | char *s[5] = { "NO HAND", "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR" }; | ^~~~~~~~~~~~ main.cpp:7:63: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 7 | char *s[5] = { "NO HAND", "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR" }; | ^~~~~~~~~~ main.cpp:7:75: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 7 | char *s[5] = { "NO HAND", "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR" }; | ^~~~~~~~~~
ソースコード
#include<iostream> using namespace std; int main(){ int a[5]; int count[13] = {0}; char *s[5] = { "NO HAND", "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR" }; for (int i = 0; i < 5; i++){ cin >> a[i]; count[a[i] - 1]++; } int c2 = 0, c3 = 0; for (int a = 0; a < 13; a++){ c2 += (count[a] == 2); c3 += (count[a] == 3); } int ans = 0; if (c2 == 1 && c3 == 1) { ans = 1; } else if (c3 == 1) { ans = 2; } else if (c2 == 2) { ans = 3; } else if (c2 == 1) { ans = 4; } cout << s[ans] << endl; return 0; }