- 谁拿了最多奖学金
- 2015-10-07 16:26:33 @
语言:C
#include <stdio.h>
int main(){
int total,i,total_money=0;
scanf("%d",&total);
struct student{
char name[21];
int end;
int class_score;
char monitor;
char west;
int passage;
int money;
}inf[total];
for (i=0; i<=total-1; i++) {
inf[i].money=0;
scanf("%s %d %d %c %c %d",inf[i].name,&inf[i].end,&inf[i].class_score,&inf[i].monitor,&inf[i].west,&inf[i].passage);
}
//判断奖金金额
for (i=0; i<=total-1; i++) {
if (inf[i].end>80&&inf[i].passage>=1) {
inf[i].money+=8000;
}
if (inf[i].end>85&&inf[i].class_score>80) {
inf[i].money+=4000;
}
if (inf[i].end>90) {
inf[i].money+=2000;
}
if (inf[i].end>85&&inf[i].west=='Y') {
inf[i].money+=1000;
}
if (inf[i].end>80&&inf[i].monitor=='Y') {
inf[i].money+=850;
}
}
//计算总金额
for (i=0; i<=total-1; i++) {
total_money+=inf[i].money;
}
//计算最大奖金金额的学生信息
for (i=1; i<=total-1; i++) {
if (inf[0].money<inf[i].money) {
inf[0]=inf[i];
}
}
//输出结果
printf("%s\n%d\n%d",inf[0].name,inf[0].money,total_money);
return 0;
}
2 条评论
-
TerryChen LV 5 @ 2016-07-06 09:19:17
呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵
-
2015-10-23 12:01:58@
同
- 1