結果
| 問題 | No.24 数当てゲーム |
| コンテスト | |
| ユーザー |
sasa
|
| 提出日時 | 2025-03-03 11:08:44 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 911 bytes |
| 記録 | |
| コンパイル時間 | 400 ms |
| コンパイル使用メモリ | 26,240 KB |
| 実行使用メモリ | 8,612 KB |
| 最終ジャッジ日時 | 2025-03-03 11:09:36 |
| 合計ジャッジ時間 | 1,053 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 10 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:26:28: warning: multi-character character constant [-Wmultichar]
26 | if(*str == 'NO'){
| ^~~~
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d",&val);
| ^~~~~~~~~~~~~~~~
main.c:17:25: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%d",&p[i]);
| ^~~~~~~~~~~~~~~~~
main.c:21:13: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
21 | 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;
for(int i = 0;i < 4;i++){
scanf("%d",&p[i]);
printf("%d ",p[i]);
}
char *str = malloc(101);
scanf("%s", str);
printf("%s\n", str);
for(int i = 0;i < 10;i++){
if(*str == 'NO'){
for(int j = 0;j < 4;j++){
if(num[j] == i){
judgment[i] = 1;
printf("NO:%d %d\n",i,num[j]);
}
}
}else{
for(int j = 0;j < 4;j++){
if(num[j] != i){
judgment[i] = 1;
printf("YES:%d %d\n",i,num[j]);
}
}
}
}
printf("ジャッジ:");
for(int i = 0;i < 10;i++){
printf("%d ",judgment[i]);
}
printf("\n");
i++;
}
}
sasa