結果
問題 | No.227 簡単ポーカー |
ユーザー | eri |
提出日時 | 2015-06-22 23:57:30 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 529 bytes |
コンパイル時間 | 859 ms |
コンパイル使用メモリ | 51,620 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-21 23:50:29 |
合計ジャッジ時間 | 1,484 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | AC | 2 ms
4,380 KB |
testcase_07 | AC | 2 ms
4,376 KB |
testcase_08 | AC | 1 ms
4,380 KB |
testcase_09 | AC | 1 ms
4,380 KB |
testcase_10 | AC | 2 ms
4,380 KB |
testcase_11 | AC | 2 ms
4,380 KB |
testcase_12 | AC | 1 ms
4,380 KB |
testcase_13 | AC | 1 ms
4,380 KB |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:79: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] char *s[5] = { "NO HAND", "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR" }; ^ main.cpp:7:79: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] main.cpp:7:79: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] main.cpp:7:79: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] main.cpp:7:79: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
ソースコード
#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; }