結果
問題 |
No.227 簡単ポーカー
|
ユーザー |
|
提出日時 | 2018-02-20 02:22:00 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 627 bytes |
コンパイル時間 | 768 ms |
コンパイル使用メモリ | 30,976 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-16 04:06:01 |
合計ジャッジ時間 | 1,105 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 4 |
コンパイルメッセージ
main.c: In function 'main': main.c:19:20: warning: iteration 4 invokes undefined behavior [-Waggressive-loop-optimizations] 19 | B[A[i]]++; | ~^~~ main.c:16:27: note: within this loop 16 | for (int i = 1; i <= 5; ++i) | ~~^~~~
ソースコード
#include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> int main(int argc, char const *argv[]) { int A[5],B[14]; int three_card=0,pair=0; for (int i = 1; i <= 13; ++i) { B[i]=0; } for (int i = 1; i <= 5; ++i) { scanf("%d",&A[i]); B[A[i]]++; } for (int i = 1; i <= 13; ++i) { if(B[i]==3){ three_card=1; }else if(B[i]==2){ pair++; } } if(three_card==1 && pair==1){ printf("FULL HOUSE\n"); }else if(three_card==1){ printf("THREE CARD\n"); }else if(pair==2){ printf("TWO PAIR\n"); }else if(pair==1){ printf("PAIR\n"); }else{ printf("NO HAND\n"); } return 0; }