結果
問題 | No.1468 Colourful Pastel |
ユーザー |
![]() |
提出日時 | 2021-05-10 14:18:06 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 17 ms / 1,000 ms |
コード長 | 1,470 bytes |
コンパイル時間 | 1,038 ms |
コンパイル使用メモリ | 21,504 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 18:41:45 |
合計ジャッジ時間 | 1,921 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
コンパイルメッセージ
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); | ^~~~~~~~~~~~~~
ソースコード
#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; }