- 谁拿了最多奖学金
 - @ 2016-03-07 21:12:41
 
#include<iostream>
    #include<string>
    using namespace std;
    int main(){
        int n;
        cin>>n;
        struct student{
            string name;
            int qimo;
            int banji;
            string ganbu;
            string xibu;
            int paper;
        };
        student a[100];
        int b[100];
        int r=0,s=0,t=0;
        for(int i=0;i<=n-1;i++){
            cin>>a[i].name;
            cin>>a[i].qimo;
            cin>>a[i].banji;
            cin>>a[i].ganbu;
            cin>>a[i].xibu;
            cin>>a[i].paper;
            b[i]=0;
        }
        for(int i=0;i<=n-1;i++){
            if((a[i].qimo>80)&&(a[i].paper>0)){b[i]=b[i]+8000;}
            if((a[i].qimo>85)&&(a[i].banji>80)){b[i]=b[i]+4000;}
            if(a[i].qimo>90){b[i]=b[i]+2000;}
            if((a[i].qimo)>85&&(a[i].xibu=="Y")){b[i]=b[i]+1000;}
            if((a[i].qimo>80)&&(a[i].ganbu=="Y")){b[i]=b[i]+850;}
            if(b[i]>r){r=b[i];s=i;}
            t=t+b[i];
        }
        cout<<a[s].name<<
            '\n'<<r<<'\n'<<t<<endl;
     return 0;
     }
为何是30....想不懂....
3 条评论
- 
  hxe LV 5 @ 2016-03-28 00:28:27
我也是一直30...你知道哪错了吗?也是醉了
 - 
  @ 2016-03-21 17:29:44
六六六
 - 
  @ 2016-03-16 16:33:19
// input code hereFree Pascal Compiler version 3.0.0 [2015/11/16] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling foo.pas
Linking foo.exe
60 lines compiled, 0.0 sec, 27920 bytes code, 1268 bytes data测试数据 #0: Accepted, time = 0 ms, mem = 864 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 864 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 860 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 864 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 864 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 860 KiB, score = 10
测试数据 #6: Accepted, time = 15 ms, mem = 856 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 860 KiB, score = 10
测试数据 #8: Accepted, time = 15 ms, mem = 860 KiB, score = 10
测试数据 #9: Accepted, time = 15 ms, mem = 864 KiB, score = 10
Accepted, time = 45 ms, mem = 864 KiB, score = 100
代码
program noip2007;var
a:array[1..30001] of integer;
i,n,j,sum,max:integer;procedure qsort(l,r:integer);
var i,j,mid,p:integer;
begin
i:=l;j:=r;
mid:=a[(l+r) div 2];repeat
while a[i]>mid do
i:=i+1;
while a[j]<mid do
j:=j-1;
if i<=j then
begin
p:=a[i];
a[i]:=a[j];
a[j]:=p;
i:=i+1;
j:=j-1;
end;until i>j;
if l<j then qsort(l,j);
if i<r then qsort(i,r);
end;begin
readln(max);
readln(n);
sum:=0;
for i:=1 to n do
readln(a[i]);
qsort(1,n);i:=1;
j:=n;
while i<j do
begin
if a[i]+a[j]<=max then
begin
inc(i);
dec(j);
inc(sum);
end
else begin
i:=i+1;
sum:=sum+1;
end;
end;
if i=j then sum:=sum+1;write(sum);
end.
 
- 1