結果

問題 No.516 赤と青の風船
ユーザー monburan_0401monburan_0401
提出日時 2018-09-13 13:46:21
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 319 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 28,672 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-01 04:22:44
合計ジャッジ時間 665 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 3 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:9:17: warning: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    9 |                 gets(color);
      |                 ^~~~
      |                 fgets
/usr/bin/ld: /tmp/cc6Gnc2s.o: in function `main':
main.c:(.text.startup+0x1f): 警告: the `gets' function is dangerous and should not be used.

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void){
	int red = 0;
	int blue = 0;
	char color[5];
	
	for(int i = 0; i < 3; i++){
		gets(color);
		if(color[0] == 'R'){
			red++;
		}else if(color[1] == 'B'){
			blue++;
		}
	}
	
	if(red > blue){
		printf("RED\n");
	}else{
		printf("BLUE\n");
	}
	return 0;
}
0