結果
問題 | No.227 簡単ポーカー |
ユーザー | FF256grhy |
提出日時 | 2015-06-19 23:35:16 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 507 bytes |
コンパイル時間 | 142 ms |
コンパイル使用メモリ | 23,424 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 04:22:09 |
合計ジャッジ時間 | 787 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 0 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 0 ms
5,376 KB |
testcase_04 | AC | 0 ms
5,376 KB |
testcase_05 | AC | 0 ms
5,376 KB |
testcase_06 | AC | 0 ms
5,376 KB |
testcase_07 | AC | 0 ms
5,376 KB |
testcase_08 | AC | 0 ms
5,376 KB |
testcase_09 | AC | 0 ms
5,376 KB |
testcase_10 | AC | 1 ms
5,376 KB |
testcase_11 | AC | 1 ms
5,376 KB |
testcase_12 | AC | 1 ms
5,376 KB |
testcase_13 | AC | 0 ms
5,376 KB |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:23: 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:34: 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:48: 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:62: 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:74: 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:9:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d", &a[i]); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include <stdio.h> int memo[13]; int main(void) { int i, a[5]; char *s[5] = {"NO HAND", "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR"}; for(i = 0; i < 5; i++) { scanf("%d", &a[i]); memo[ a[i] - 1 ]++; } int c2 = 0, c3 = 0; for(i = 0; i < 13; i++) { c2 += (memo[i] == 2); c3 += (memo[i] == 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; } printf("%s\n", s[ans]); return 0; }