結果

問題 No.2599 Summer Project
ユーザー Maeda
提出日時 2025-03-17 14:57:36
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 536 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 25,728 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-17 14:57:37
合計ジャッジ時間 1,081 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%s",s);
      |         ^~~~~~~~~~~~~
main.c:15:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |         scanf("%s",t);
      |         ^~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>
void main(void){
	char summerList[3][1000] ={"watermelon","beachball","shrinebell"};
	int countList[3] = {0,0,0};
	char s[1000] = "a";
	scanf("%s",s);
	for(int i = 0 ; i < 3 ; i++){
		if(strcmp(s,summerList[i])== 0){
			countList[i]++;
			break;
		}
	}
	char t[1000] = "a";
	scanf("%s",t);
	for(int i = 0 ; i < 3 ; i++){
		if(strcmp(t,summerList[i])== 0){
			countList[i]++;
			break;
		}
	}
	for(int i = 0 ; i < 3 ; i++){
		if(countList[i] == 0){
			printf("%s",summerList[i]);
			break;
		}
	}
}
0