結果

問題 No.1468 Colourful Pastel
ユーザー suppy193suppy193
提出日時 2021-05-10 14:18:06
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 19 ms / 1,000 ms
コード長 1,470 bytes
コンパイル時間 352 ms
コンパイル使用メモリ 22,136 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 22:43:07
合計ジャッジ時間 1,518 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
4,348 KB
testcase_01 AC 19 ms
4,348 KB
testcase_02 AC 0 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 0 ms
4,348 KB
testcase_11 AC 0 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 0 ms
4,348 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 AC 0 ms
4,348 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 0 ms
4,348 KB
testcase_25 AC 1 ms
4,348 KB
testcase_26 AC 0 ms
4,348 KB
testcase_27 AC 16 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:12:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:14:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |                 scanf("%s", s);
      |                 ^~~~~~~~~~~~~~
main.c:38:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   38 |                 scanf("%s", s);
      |                 ^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include<string.h>

int main(void) {

	int n;
	int i;
	char s[10];
	int red1 = 0, orange1 = 0, yellow1 = 0, green1 = 0, cyan1 = 0, blue1 = 0, violet1 = 0;
	int red2 = 0, orange2 = 0, yellow2 = 0, green2 = 0, cyan2 = 0, blue2 = 0, violet2 = 0;

	scanf("%d", &n);
	for(i = 0;i < n;i++){
		scanf("%s", s);
		if(strcmp(s, "Red") == 0){
			red1++;
		}
		else	if(strcmp(s, "Orange") == 0){
			orange1++;
		}
		else	if(strcmp(s, "Yellow") == 0){
			yellow1++;
		}
		else	if(strcmp(s, "Green") == 0){
			green1++;
		}
		else	if(strcmp(s, "Cyan") == 0){
			cyan1++;
		}
		else	if(strcmp(s, "Blue") == 0){
			blue1++;
		}
		else	if(strcmp(s, "Violet") == 0){
			violet1++;
		}
	}
	for(i = 0;i < n - 1;i++){
		scanf("%s", s);
		if(strcmp(s, "Red") == 0){
			red2++;
		}
		else	if(strcmp(s, "Orange") == 0){
			orange2++;
		}
		else	if(strcmp(s, "Yellow") == 0){
			yellow2++;
		}
		else	if(strcmp(s, "Green") == 0){
			green2++;
		}
		else	if(strcmp(s, "Cyan") == 0){
			cyan2++;
		}
		else	if(strcmp(s, "Blue") == 0){
			blue2++;
		}
		else	if(strcmp(s, "Violet") == 0){
			violet2++;
		}
	}
	if(red1 != red2){
		printf("Red\n");
	}
	else if(orange1 != orange2){
		printf("Orange\n");
	}
	else if(yellow1 != yellow2){
		printf("Yellow\n");
	}
	else if(green1 != green2){
		printf("Green\n");
	}
	else if(cyan1 != cyan2){
		printf("Cyan\n");
	}
	else if(blue1 != blue2){
		printf("Blue\n");
	}
	else if(violet1 != violet2){
		printf("Violet\n");
	}

	return 0;
}
0