結果
| 問題 |
No.227 簡単ポーカー
|
| コンテスト | |
| ユーザー |
sasa
|
| 提出日時 | 2025-03-05 10:56:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 743 bytes |
| コンパイル時間 | 390 ms |
| コンパイル使用メモリ | 27,776 KB |
| 実行使用メモリ | 8,612 KB |
| 最終ジャッジ日時 | 2025-03-05 10:56:39 |
| 合計ジャッジ時間 | 1,338 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:22: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
20 | char *ans = "NO HAND";
| ^~~~~~~~~
main.cpp:23:31: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
23 | ans = "ONE PAIR";
| ^~~~~~~~~~
main.cpp:25:31: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
25 | ans = "THREE CARD";
| ^~~~~~~~~~~~
main.cpp:27:31: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
27 | ans = "TWO PAIR";
| ^~~~~~~~~~
main.cpp:29:31: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
29 | ans = "FULL HOUSE";
| ^~~~~~~~~~~~
main.cpp:31:31: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
31 | ans = "FULL HOUSE";
| ^~~~~~~~~~~~
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 j = 0;j < 13;j++){
if(j + 1 == p[i]){
cp[j] += 1;
}
}
}
for(int i = 0;i < 13;i++){
//printf("%d ",count[i]);
}
printf("\n");
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] == 3 && ans == "ONE PAIR"){
ans = "FULL HOUSE";
}else if(cp[i] == 2 && ans == "THREE CARD"){
ans = "FULL HOUSE";
}
}
printf("%s",ans);
}
sasa