- 谁拿了最多奖学金
- 2013-11-08 12:19:21 @
测试数据 #0: Accepted, time = 0 ms, mem = 448 KiB, score = 10
测试数据 #1: WrongAnswer, time = 15 ms, mem = 448 KiB, score = 0
测试数据 #2: Accepted, time = 0 ms, mem = 448 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 452 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 452 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 452 KiB, score = 10
测试数据 #6: Accepted, time = 0 ms, mem = 448 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 452 KiB, score = 10
测试数据 #8: Accepted, time = 15 ms, mem = 448 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 448 KiB, score = 10
WrongAnswer, time = 30 ms, mem = 452 KiB, score = 90
#include<stdio.h>
typedef struct
{
char name[20];
int score1;
int score2;
char gan;
char west;
int essay;
int sum;
}stu;
int main()
{
int n;
scanf("%d",&n);
stu list[n];
int i,j;
char temp;
for(i=0;i<n;i++)
{
j=0;
while(scanf("%c",&temp),temp!=' ')
{
list[i].name[j] = temp;
j++;
}
list[i].name[j] = '\0';
scanf("%d",&list[i].score1);//printf("%d\n",list[i].score1);
scanf("%d",&list[i].score2);scanf("%c",&temp);//printf("%d\n",list[i].score2);
scanf("%c",&list[i].gan);scanf("%c",&temp);//printf("%c\n",list[i].gan);
scanf("%c",&list[i].west);//printf("%c\n",list[i].west);
scanf("%d",&list[i].essay);//printf("%d\n",list[i].essay);
list[i].sum = 0;
if(list[i].score1 > 80 && list[i].essay>=1)list[i].sum+=8000;
if(list[i].score1 > 85 && list[i].score2>80)list[i].sum+=4000;
if(list[i].score1 > 90)list[i].sum+=2000;
if(list[i].score1 > 85 && list[i].west=='Y')list[i].sum+=1000;
if(list[i].score2 > 80 && list[i].gan=='Y')list[i].sum+=850;
}
int biao,max = 0;
int sum = 0;
for(i=0;i<n;i++)
{
if(list[i].sum>max)
{
max = list[i].sum;
biao = i;
}
sum+=list[i].sum;
}
//printf("%d",biao);
int len = strlen(list[biao].name);
for(i=0;i<len;i++)
{
printf("%c",list[biao].name[i]);
}
printf("\n");
printf("%d\n",list[biao].sum);
printf("%d",sum);
system("pause");
return 0;
}
求解 用了noip的数据没问题啊!
2 条评论
-
mrw LV 10 MOD @ 2013-11-15 13:59:09
贴代码,请在选中所有代码按一次TAB键,即可保留缩进并高亮。
# include <iostream>
using namespace std;int main()
{
int a, b;
cin >> a >> b;
cout << a + b << endl;
return 0;
} -
2013-11-14 21:09:50@
不自到和恢复速度更快多舒服能看见别人宁波
var
name:array[1..100] of string;
scoreA,scoreB:array[1..100] of integer;
west,job:array[1..100] of boolean;
article:array[1..100] of boolean;
i,j,n:integer;
total:longint;
l,s:string;
money:array[1..100] of LONGINT;
procedure getdata;
begin
readln(n);
for j:=1 to n do
begin
readln(l);
i:=pos(' ',l);
name[j]:=copy(l,1,i-1);
delete(l,1,i);
i:=pos(' ',l);
s:=copy(l,1,i-1);
if length(s)=3 then scoreA[j]:=100 else
scoreA[j]:=10 *(ord(s[1])-ord('0')) +( ord(s[2])-ord('0'));
delete(l,1,i);
i:=pos(' ',l);
s:=copy(l,1,i-1);
if length(s)=3 then scoreB[j]:=100 else
scoreB[j]:=10 *(ord(s[1])-ord('0')) +( ord(s[2])-ord('0'));
delete(l,1,i);
i:=pos(' ',l);
s:=copy(l,1,i-1);
if s='Y' then job[j]:=true
else job[j]:=false;
delete(l,1,i);
i:=pos(' ',l);
s:=copy(l,1,i-1);
if s='Y' then west[j]:=true
else west[j]:=false;
delete(l,1,i);
i:=length(l);
s:=copy(l,1,i);
if s<>'0' then article[j]:=true else article[j]:=false;
end;
end;
procedure tongji;
var
i:integer;
begin
for i:=1 to n do
begin
if( scoreA[i] > 80) and( article[i]) then money[i]:=money[i]+8000;
if(scoreA[i] > 85) and(scoreB[i]>80) then money[i]:=money[i]+4000;
if (scoreA[i]>90) then money[i]:=money[i]+2000;
if (scoreA[i]>85) and( west[i]) then money[i]:=money[i]+1000;
if(scoreB[i]>80) and (job[i]) then money[i]:=money[i]+850;
end;
end;
procedure compelte;
var
i,max:integer;
begin
for i:=1 to n do
total:=total+money[i];
max:=money[1];
for i:=2 to n do
if money[i]>max then
begin
max:=money[i];
j:=i;
end;
writeln(name[j]);
writeln(max);
writeln(total);
end;
BEGIN
total:=0;
getdata;
tongji;
compelte;end.
- 1