結果

問題 No.516 赤と青の風船
ユーザー monburan_0401monburan_0401
提出日時 2018-09-13 13:46:58
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 319 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 27,924 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 19:49:03
合計ジャッジ時間 661 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 0 ms
4,380 KB
testcase_07 AC 0 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:9:17: 警告: implicit declaration of function ‘gets’; did you mean ‘fgets’? [-Wimplicit-function-declaration]
    9 |                 gets(color);
      |                 ^~~~
      |                 fgets
/tmp/ccOZc16Q.o: In function `main':
main.c:(.text.startup+0x1a): warning: 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[0] == 'B'){
			blue++;
		}
	}
	
	if(red > blue){
		printf("RED\n");
	}else{
		printf("BLUE\n");
	}
	return 0;
}
0