#include #include #define ARRAY_NUM 100000 void jenga(); // void poker(); int main(void) { poker(); return 0; } void poker() { int i, j, same_num, max_same_num, min, temp, second_same_num, pair_num; int cards[5] = { }; i = j = max_same_num = same_num = second_same_num = pair_num = min = 0; scanf("%d %d %d %d %d", &cards[0], &cards[1], &cards[2], &cards[3], &cards[4]); for (i = 0; i < 5; i++) { for (j = i; j < 5; j++) { if (cards[i] > cards[j]) { temp = cards[i]; cards[i] = cards[j]; cards[j] = temp; } } } int debug = 0; while (debug++ < 5) { printf("%d ",cards[debug-1]); } for (i = 0; i < 4; i++) { if (cards[i] == cards[i + 1]) { same_num++; pair_num++; max_same_num = max_same_num > same_num ? max_same_num : same_num; } else { same_num = 0; } } if ((cards[0] == cards[1]) && (cards[3] == cards[4])) { second_same_num++; } switch (max_same_num) { case 0: printf("NO HAND\n"); break; case 1: if (pair_num == 1) { printf("ONE PAIR\n"); } else { printf("TWO PAIR\n"); } break; case 2: if (second_same_num == 0) { printf("THREE CARD\n"); } else { printf("FULL HOUSE\n"); } break; } }