結果
| 問題 |
No.227 簡単ポーカー
|
| コンテスト | |
| ユーザー |
sasa
|
| 提出日時 | 2025-03-05 10:49:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 665 bytes |
| コンパイル時間 | 643 ms |
| コンパイル使用メモリ | 28,160 KB |
| 実行使用メモリ | 8,608 KB |
| 最終ジャッジ日時 | 2025-03-05 10:50:00 |
| 合計ジャッジ時間 | 1,451 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:22: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
19 | char *ans = "NO HAND";
| ^~~~~~~~~
main.cpp:22:31: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
22 | ans = "ONE PAIR";
| ^~~~~~~~~~
main.cpp:24:31: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
24 | ans = "THREE CARD";
| ^~~~~~~~~~~~
main.cpp:26:31: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
26 | ans = "TWO PAIR";
| ^~~~~~~~~~
main.cpp:28:31: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
28 | 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 i = 0;i < 13;i++){
if(i + 1 == p[i]){
cp[i] += 1;
}
}
}
for(int i = 0;i < 13;i++){
printf("%d ",count[i]);
}
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);
}
sasa