vj p1001题解
原题地址http://www.vijos.cn/Problem_Show.asp?id=1001
题很水很简单,照着题目要求一步一步来即可,模拟题。
(突然发现怎么没法在代码框内打中文呢......汗....)
代码如下:
1 var n,i:longint;
2 ch1,ch2,ch:char;
3 re,s:string;
4 a,b,c,all,reall,call:longint;
5 function count(a,b:longint;ch1,ch2:char;c:longint):longint;
6 var t:longint;
7 begin
8 t:=0;
9 if (a>80)and(c>=1) then t:=t+8000;
10 if (a>85)and(b>80) then t:=t+4000;
11 if (a>90) then t:=t+2000;
12 if (a>85)and(ch2='Y') then t:=t+1000;
13 if (b>80)and(ch1='Y') then t:=t+850;
14 exit(t);
15 end;
16 begin
17
18 readln(n);
19 reall:=0;
20 call:=0;
21 for i:=1 to n do
22 begin
23 read(ch);
24 s:='';
25 while ch<>' ' do{pay attention to the space,and read one by one}
26 begin
27 s:=s+ch;
28 read(ch);
29 end;
30 read(a,b,ch);
31 readln(ch1,ch,ch2,ch,c);
32 all:=count(a,b,ch1,ch2,c);
33 call:=call+all;
34 if all>reall then
35 begin
36 re:=s;
37 reall:=all;
38 end;
39 end;
40 writeln(re);
41 writeln(reall);
42 writeln(call);
43
44 end.
2 ch1,ch2,ch:char;
3 re,s:string;
4 a,b,c,all,reall,call:longint;
5 function count(a,b:longint;ch1,ch2:char;c:longint):longint;
6 var t:longint;
7 begin
8 t:=0;
9 if (a>80)and(c>=1) then t:=t+8000;
10 if (a>85)and(b>80) then t:=t+4000;
11 if (a>90) then t:=t+2000;
12 if (a>85)and(ch2='Y') then t:=t+1000;
13 if (b>80)and(ch1='Y') then t:=t+850;
14 exit(t);
15 end;
16 begin
17
18 readln(n);
19 reall:=0;
20 call:=0;
21 for i:=1 to n do
22 begin
23 read(ch);
24 s:='';
25 while ch<>' ' do{pay attention to the space,and read one by one}
26 begin
27 s:=s+ch;
28 read(ch);
29 end;
30 read(a,b,ch);
31 readln(ch1,ch,ch2,ch,c);
32 all:=count(a,b,ch1,ch2,c);
33 call:=call+all;
34 if all>reall then
35 begin
36 re:=s;
37 reall:=all;
38 end;
39 end;
40 writeln(re);
41 writeln(reall);
42 writeln(call);
43
44 end.