結果
| 問題 | No.227 簡単ポーカー | 
| コンテスト | |
| ユーザー |  sasa | 
| 提出日時 | 2025-03-05 10:48:20 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 608 bytes | 
| コンパイル時間 | 591 ms | 
| コンパイル使用メモリ | 28,032 KB | 
| 実行使用メモリ | 8,612 KB | 
| 最終ジャッジ日時 | 2025-03-05 10:48:22 | 
| 合計ジャッジ時間 | 1,338 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 4 WA * 10 | 
コンパイルメッセージ
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: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);
}
            
            
            
        