Scholarship
Time Limit: 20 Sec
Memory Limit: 256 MB
题目连接
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=86686#problem/D
Description
At last the first term at the University came to its finish. Android Vasya has already passed all the exams and wants to know if he gets a scholarship. There is the following practice of giving scholarship to students at the University:
- if a student has got satisfactory marks, the scholarship is not given,
- if a student has passed through the examination period with only excellent marks, he gets a personal scholarship,
- if a student doesn’t get a personal scholarship and his average mark is not less than 4.5, he gets a high scholarship,
- if a student gets neither high nor personal scholarship and doesn’t have satisfactory marks, he gets a common scholarship.
A satisfactory mark corresponds to value 3, a good mark corresponds to value 4, and an excellent mark corresponds to value 5. An average mark for a student is the average value of all the marks this student got in his exams. Help Vasya find out which scholarship he gets.
Input
The first line contains an integer n that is the number of exams (1 ≤ n ≤ 10). In the i-th of the next n lines there is an integer mi that is value of Vasya’s mark in i-th exam (3 ≤ mi ≤ 5).
Output
If Vasya doesn’t get any scholarship output “None”. If he gets a common scholarship output “Common”, if he gets a high scholarship output “High”, if he gets a personal one output “Named”.
Sample Input
3
5
5
4
Sample Output
High
HINT
题意
给n门课,如果有一门为3分,那就没有奖学金,如果所有都是5分,那就单人奖学金,如果平均分超过4.5,就High奖学金,其他就普通奖学金
题解:
水题,读完题就A了……
代码:
#include <cstdio> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <algorithm> #include <set> #include <vector> #include <sstream> #include <queue> #include <typeinfo> #include <fstream> #include <map> #include <stack> typedef long long ll; using namespace std; //freopen("D.in","r",stdin); //freopen("D.out","w",stdout); #define sspeed ios_base::sync_with_stdio(0);cin.tie(0) #define test freopen("test.txt","r",stdin) #define maxn 20001 #define mod 1000000007 #define eps 1e-9 const int inf=0x3f3f3f3f; const ll infll = 0x3f3f3f3f3f3f3f3fLL; inline ll read() { ll x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } //************************************************************************************** int a[1000]; int main() { int n=read(); int flag=0; int sum=0; for(int i=0;i<n;i++) { cin>>a[i]; if(a[i]==3) flag=1; sum+=a[i]; } if(flag) { cout<<"None"<<endl; } else if(sum==5*n) { cout<<"Named"<<endl; } else if(sum>=4.5*(double)n) { cout<<"High"<<endl; } else cout<<"Common"<<endl; }