1. 程式人生 > >【PAT】B1038 統計同成績學生(20)(20 分)

【PAT】B1038 統計同成績學生(20)(20 分)

自己的 code return scanf pre pat can 學生 include

#include<stdio.h>
int arr[102]={0};//分數作為自己的下標,註意
int main(){
    int N;scanf("%d",&N);
    for(int i=0;i<N;i++){
        int temp;scanf("%d",&temp);
        arr[temp]++;
    }
    int N2;scanf("%d",&N2);
    for(int i=1;i<=N2;i++){
        if(i!=1)printf(" ");
        int temp;scanf("%d",&temp);
        printf("%d",arr[temp]);
    }

    return  0;
}

【PAT】B1038 統計同成績學生(20)(20 分)