結果

問題 No.227 簡単ポーカー
ユーザー FF256grhyFF256grhy
提出日時 2015-06-19 23:35:16
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 507 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 25,400 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-21 10:18:03
合計ジャッジ時間 995 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:77: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
  char *s[5] = {"NO HAND", "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR"};
                                                                             ^
main.cpp:7:77: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
main.cpp:7:77: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
main.cpp:7:77: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
main.cpp:7:77: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]

ソースコード

diff #

#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;
}
0