VIJOS上第一题,PASCAL高手进,P1001

来源:百度知道 编辑:UC知道 时间:2024/05/13 04:17:39
program P1001;
type student=record
name:string;
last:integer;
clas:integer;
ganbu,west:boolean;
article:integer;
end;
var a:array[1..1000] of student;
sum,money,max,i,j,n,m:integer;
s:string;
c1,ch:char;
begin
readln(n);
for i:=1 to n do
begin
read(ch);
s:='';
repeat
s:=s+ch;
read(ch);
until ch=' ';
a[i].name:=s;
read(a[i].last);
read(a[i].clas);
read(c1);read(ch);
if ch='Y' then a[i].ganbu:=true
else a[i].ganbu:=false;
read(c1);read(ch);
if ch='Y' then a[i].west:=true
else a[i].west:=false;
read(a[i].article);
readln;
end;
max:=0;
m:=1;
for i:=1 to n do
begin
money:=0;
if (a[i].last>80) and (a[i].article>=1) then money:=money+8000;
if (a[i].last>85) and (a[i].clas>80

把sum,money,max,i,j,n,m:integer; 的integer改成longint;
善意的提醒一句:
以后定义integer时最好改为longint,因为integer和longint的用法一样,而longint的范围却大很多.所以......

样例输入给的数据很弱滴````把变量数据类型改成longint就行了,变量超范围就出负数了,不像数组越界还提示201呢o(∩_∩)o...