結果
問題 | No.24 数当てゲーム |
ユーザー | Hissha_ |
提出日時 | 2018-03-29 21:22:29 |
言語 | C (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,154 bytes |
コンパイル時間 | 195 ms |
コンパイル使用メモリ | 29,952 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-25 23:52:11 |
合計ジャッジ時間 | 618 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,812 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 1 ms
6,944 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
コンパイルメッセージ
main.c: In function 'cal': main.c:39:25: warning: passing argument 1 of 'strcmp' from incompatible pointer type [-Wincompatible-pointer-types] 39 | if(strcmp(&h,&y)==0){ | ^~ | | | char (*)[3] In file included from main.c:3: /usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char (*)[3]' 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ main.c:39:28: warning: passing argument 2 of 'strcmp' from incompatible pointer type [-Wincompatible-pointer-types] 39 | if(strcmp(&h,&y)==0){ | ^~ | | | char (*)[3] /usr/include/string.h:156:50: note: expected 'const char *' but argument is of type 'char (*)[3]' 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ main.c:61:25: warning: passing argument 1 of 'strcmp' from incompatible pointer type [-Wincompatible-pointer-types] 61 | if(strcmp(&h,&n)==0){ | ^~ | | | char (*)[3] /usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char (*)[3]' 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ main.c:61:28: warning: passing argument 2 of 'strcmp' from incompatible pointer type [-Wincompatible-pointer-types] 61 | if(strcmp(&h,&n)==0){ | ^~ | | | char (*)[3] /usr/include/string.h:156:50: note: expected 'const char *' but argument is of type 'char (*)[3]' 156 | extern int strcmp (const char *__s1, const char *__s2) |
ソースコード
#include <stdio.h> #include<string.h> struct say{ int card0; int card1; int card2; int card3; char hantei[3]; }; void cal(int hav[], struct say *answer){ int i, j, count=0; char y[3], n[3], h[3]; strcpy(y,"YES"); strcpy(n,"NO"); strcpy(h,answer->hantei); if(strcmp(&h,&y)==0){ for(i=0;i<10;i++){ if(i==answer->card0) count+=1; if(i==answer->card1) count+=1; if(i==answer->card2) count+=1; if(i==answer->card3) count+=1; if(count==0) hav[i]=0; count=0; } } if(strcmp(&h,&n)==0){ for(i=0;i<10;i++){ if(i==answer->card0) count+=1; if(i==answer->card1) count+=1; if(i==answer->card2) count+=1; if(i==answer->card3) count+=1; if(count!=0) hav[i]=0; count=0; } } } int main(void) { // your code goes here int turn, i, j; int have[10]={1,1,1,1,1,1,1,1,1,1}; struct say taro; scanf("%d", &turn); for(i=0;i<turn;i++){ scanf("%d %d %d %d %s", &taro.card0, &taro.card1, &taro.card2, &taro.card3, taro.hantei); cal(have, &taro); } for(j=0;j<10;j++){ if(have[j]==1) printf("%d",j); } return 0; }