POJ 2715 谁拿了最多奖学金 解题报告
POJ 2715 谁拿了最多奖学金 解题报告
编号:2715
考查点:简单计算题
思路: 几种情况都算下就行了
提交情况: 一次AC.。
Source Code:
//POJ Grids 2715
#include <string>
#include <iostream>
using namespace std;
string stu_name[100];
int stu_num[100];
int main()
{
int n;cin>>n;
memset(stu_name,0,sizeof stu_name);
memset(stu_num,0,sizeof stu_num);
for (int i=0;i<n;i++)
{
int sc1,sc2;
char fl1,fl2;
int c;
cin>>stu_name[i];
cin>>sc1>>sc2>>fl1>>fl2>>c;
if (sc1>80&&c)
stu_num[i] += 8000;
if (sc1>85&&sc2>80)
stu_num[i] += 4000;
if (sc1>90)
stu_num[i] += 2000;
if (sc1>85&&fl2=='Y')
stu_num[i] += 1000;
if (sc2>80&&fl1=='Y')
stu_num[i] += 850;
}
int max_index = 0;
int max_num = 0;
for (int i=0;i<n;i++)
{
if (stu_num[i]>stu_num[max_index])
max_index = i;
max_num += stu_num[i];
}
cout<<stu_name[max_index]<<endl<<stu_num[max_index]<<endl<<max_num<<endl;
return 0;
}
总结: 还是水题,没办法,俺是菜鸟,现在就会切菜题,话说明天正是开始算法导论了,加油.。
By Ns517
Time 09.02.28