AtCoder Beginner Contest 064

Submission #1591637

Source codeソースコード

#include <stdio.h>

int main(void){
  int i,N,a[100],min=0,max=0;
  int ratecolor[9]={};

  scanf("%d",&N);

  for(i=0;i<N;i++){
    scanf("%d",&a[i]);
    if(a[i]<400){
      ratecolor[0]++;
    }else if(400<=a[i]&&a[i]<800){
      ratecolor[1]++;
    }else if(800<=a[i]&&a[i]<1200){
      ratecolor[2]++;
    }else if(1200<=a[i]&&a[i]<1600){
      ratecolor[3]++;
    }else if(1600<=a[i]&&a[i]<2000){
      ratecolor[4]++;
    }else if(2000<=a[i]&&a[i]<2400){
      ratecolor[5]++;
    }else if(2400<=a[i]&&a[i]<2800){
      ratecolor[6]++;
    }else if(2800<=a[i]&&a[i]<3200){
      ratecolor[7]++;
    }else if(3200<=a[i]){
      ratecolor[8]++;
    }
  }

  for(i=0;i<8;i++){
    if(ratecolor[i]>0){
      min++;
      max++;
    }
  }
  if(ratecolor[8]!=0){
    max=max+ratecolor[8];
  }

  if(N=1&&a[0]>=3200){
    min=1;
  }

  printf("%d %d\n",min,max);

  return 0;
}

Submission

Task問題 C - Colorful Leaderboard
User nameユーザ名 Ringler
Created time投稿日時
Language言語 C (GCC 5.4.1)
Status状態 AC
Score得点 300
Source lengthソースコード長 927 Byte
File nameファイル名
Exec time実行時間 1 ms
Memory usageメモリ使用量 128 KB

Compiler messageコンパイルメッセージ

./Main.c: In function ‘main’:
./Main.c:7:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&N);
^
./Main.c:10:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&a[i]);
^

Test case

Set

Set name Score得点 / Max score Cases
Sample - s1.txt,s2.txt,s3.txt
All 300 / 300 in1.txt,in2.txt,in3.txt,in4.txt,in5.txt,s1.txt,s2.txt,s3.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
in1.txt AC 1 ms 128 KB
in2.txt AC
in3.txt AC
in4.txt AC
in5.txt AC 1 ms 128 KB
s1.txt AC
s2.txt AC
s3.txt AC