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

转载于:https://www.cnblogs.com/ns517/archive/2009/02/28/1400533.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值