- 谁拿了最多奖学金
- 2015-06-05 22:28:25 @
##include <stdio.h>
##include <string.h>
int main(int argc, char **argv)
{
int count;
scanf("%d", &count);
char name[30], f1, f2;
char maxname[30];
int s1,s2,lc;
long long sum, sum2=0;
long long max = 0;
while(count--)
{
scanf("%s %d %d %c %c %d", name, &s1, &s2, &f1, &f2, &lc);
sum = 0;
if(s1>80 && lc >= 1)
sum += 8000;
if(s1>85 && s2>80)
sum += 4000;
if(s1>90)
sum += 2000;
if(s1>85 && f2=='Y')
sum += 1000;
if(s2>80 && f1=='Y')
sum += 850;
if(sum > max)
{
max = sum;
strcpy(maxname, name);
}
sum2 += sum;
//printf("%d\n",sum);
}
printf("%s\n",maxname);
printf("%lld\n", max);
printf("%lld\n",sum2);
return 0;
}
1 条评论
-
tangyayan LV 7 @ 2015-09-03 17:02:46
#include<iostream>
#include<cstring>
char name[21],Mname[21];
using namespace std;
int main()
{
int n,i,qmcj,pycj,lw,jxj,maxxjxj,jxjtj=0;
char gb,xb;
cin>>n;
for(i=1;i<=n;i++)
{
jxj=0;
cin>>name>>qmcj>>pycj>>gb>>xb>>lw;
if((qmcj>80)&&(lw>0))
{
jxj+=8000;
}
if((qmcj>85)&&(pycj>80))
{
jxj+=4000;
}
if(qmcj>90)
{
jxj+=2000;
}
if((qmcj>85)&&(xb=='Y'))
{
jxj+=1000;
}
if((pycj>80)&&(gb=='Y'))
{
jxj+=850;
}
if((jxj>maxxjxj)||(i==1))
{
maxxjxj=jxj;
strcpy(Mname,name);
}
jxjtj+=jxj;
}
cout<<Mname<<endl;
cout<<maxxjxj<<endl;
cout<<jxjtj<<endl;
return 0;
}
LiXin 92 88 N N 0
ZhangQin 83 87 Y N 14
YaoLin 87 82 Y N 0
ChenRuiyi 88 78 N Y 1
LiXin 92 88 N N 0
ZhangQin 83 87 Y N 1
- 1