Submission #1347319


Source Code Expand

#include <stdio.h>
#include <stdlib.h>

int main(void){
    int i, n, a[101]={0}, r[10]={0}, cnt=0, cnt8=0, max=0,min=0;
    //r1=0,r2=0,r3=0,r4=0,r5=0,r6=0,r7=0,r8=0,r9=0,;
    
    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf(" %d", &a[i]);
    }

    for(i=0;i<n;i++){
        
        if(a[i]<=399){
            r[0]=1;
        }else if(a[i]<=799){
            r[1]=1;
        }else if(a[i]<=1199){
            r[2]=1;
        }else if(a[i]<=1599){
            r[3]=1;
        }else if(a[i]<=1999){
            r[4]=1;
        }else if(a[i]<=2399){
            r[5]=1;
        }else if(a[i]<=2799){
            r[6]=1;
        }else if(a[i]<=3199){
            r[7]=1;
        }else if(a[i]>=3200){
            r[8]=1;
            cnt8++;
        }
        
    }
    
    for(i=0;i<8;i++){
        if(r[i]==1)cnt++;
    }
    min=cnt;
    //if(r[8]==1 && cnt<=8 ){
    if(r[8]==1){
        //max=cnt+2;
        max=cnt+cnt8;
        //max=8;
        //min=cnt
    //}else if(r[8]==1 && cnt<=7 ){
        //max=cnt+1;
      //  max=cnt+cnt8;
        //min=cnt;
    }else{
        max=cnt;
        //min=cnt;
    }
    
    if(min==0) min=1;
    //if(max>=8) max=8;
    
    if(n<=1){
        min=1;
        max=1;
    }
    printf("%d %d\n",min, max);
    
    return 0;
}

Submission Info

Submission Time
Task C - Colorful Leaderboard
User texico
Language C (GCC 5.4.1)
Score 300
Code Size 1350 Byte
Status AC
Exec Time 0 ms
Memory 128 KB

Compile Error

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

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 8
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
in1.txt AC 0 ms 128 KB
in2.txt AC 0 ms 128 KB
in3.txt AC 0 ms 128 KB
in4.txt AC 0 ms 128 KB
in5.txt AC 0 ms 128 KB
s1.txt AC 0 ms 128 KB
s2.txt AC 0 ms 128 KB
s3.txt AC 0 ms 128 KB