結果
問題 |
No.227 簡単ポーカー
|
ユーザー |
![]() |
提出日時 | 2025-03-05 10:48:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 609 bytes |
コンパイル時間 | 527 ms |
コンパイル使用メモリ | 28,288 KB |
実行使用メモリ | 8,608 KB |
最終ジャッジ日時 | 2025-03-05 10:48:09 |
合計ジャッジ時間 | 3,385 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:16:22: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 16 | char *ans = "NO HAND"; | ^~~~~~~~~ main.cpp:19:31: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 19 | ans = "ONE PAIR"; | ^~~~~~~~~~ main.cpp:21:31: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 21 | ans = "THREE CARD"; | ^~~~~~~~~~~~ main.cpp:23:31: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 23 | ans = "TWO PAIR"; | ^~~~~~~~~~ main.cpp:25:31: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 25 | ans = "FULL HOUSE"; | ^~~~~~~~~~~~ main.cpp:29:18: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘int’ [-Wformat=] 29 | printf("%s",*ans); | ~^ ~~~~ | | | | | int | char* | %d main.cpp:9:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d",&p[i]); | ~~~~~^~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(){ int count[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0}; int *cp = count; int card[5]; int *p = card; for(int i = 0;i < 5;i++){ scanf("%d",&p[i]); for(int i = 0;i < 13;i++){ if(i + 1 == p[i]){ cp[i] += 1; } } } char *ans = "NO HAND"; for(int i = 0;i < 13;i++){ if(cp[i] == 2 && ans == "NO HAND"){ ans = "ONE PAIR"; }else if(cp[i] == 3 && ans == "NO HAND"){ ans = "THREE CARD"; }else if(cp[i] == 2 && ans == "ONE PAIR"){ ans = "TWO PAIR"; }else if(cp[i] == 2 && ans == "THERR CARD"){ ans = "FULL HOUSE"; } cp++; } printf("%s",*ans); }