top1编程
← 返回题目
题解

【入门】奖学金评级

1 条题解

  • 0
    @ 2026-7-28 22:09:21
    #include <bits/stdc++.h>
    using namespace std;
    
    int main(){
    	int a[1000],n,i,x = 0,d = 0;
    	cin>>n;
    	for(i = 0;i < n;i++){
    		cin>>a[i];
    		if(a[i] >= 90){
    			x++;
    		}else if(a[i] < 60){
    			d++;
    		}
    	}
    	
    	if(d == 0){
    		if(x == 5){
    			cout<<1<<endl;
    		}else if(x == 3|| x == 4){
    			cout<<2<<endl;
    		}else if(x == 2){
    			cout<<3<<endl;
    		}
    	}else{
    		cout<<"no"<<endl;
    	}
    }
    
    • 1