結果
| 問題 |
No.24 数当てゲーム
|
| コンテスト | |
| ユーザー |
sasa
|
| 提出日時 | 2025-03-03 13:08:45 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,043 bytes |
| コンパイル時間 | 326 ms |
| コンパイル使用メモリ | 28,032 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-03-03 13:08:48 |
| 合計ジャッジ時間 | 2,602 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 10 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:27:28: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
27 | printf("表示:%s\n",*s);
| ~^ ~~
| | |
| | int
| char *
| %d
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d",&val);
| ^~~~~~~~~~~~~~~~
main.c:18:25: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
18 | scanf("%d",&p[i]);
| ^~~~~~~~~~~~~~~~~
main.c:23:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
23 | scanf("%s", str);
| ^~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
int val = 0;
scanf("%d",&val);
printf("回数:%d\n",val);
int judgment[10] = {0,0,0,0,0,0,0,0,0,0};
int i = 0;
while(i != val){
int num[4];
int *p = num;
printf("入力:");
for(int i = 0;i < 4;i++){
scanf("%d",&p[i]);
printf("%d ",p[i]);
}
printf("\n");
char str[4];
scanf("%s", str);
char *s = str;
for(int i = 0;i < 10;i++){
printf("表示:%s\n",*s);
int count = 0;
if(*s == 'N'){
printf("NOの場合\n");
for(int j = 0;j < 4;j++){
if(num[j] == i){
judgment[i] = 1;
}
}
}else if(*s == 'Y'){
printf("YESの場合\n");
for(int j = 0;j < 4;j++){
if(num[j] != i){
count++;
}
}
if(count == val){
judgment[i] = 1;
}
}
}
i++;
}
printf("最終ジャッジ:");
for(int i = 0;i < 10;i++){
printf("%d ",judgment[i]);
}
printf("\n");
for(int i = 0;i < 10;i++){
if(judgment[i] == 0){
printf("%d",i);
}
}
}
sasa