比赛 |
20101025 |
评测结果 |
ATTTTTTTAT |
题目名称 |
NBA总冠军 |
最终得分 |
20 |
用户昵称 |
echo |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2010-10-25 20:40:31 |
显示代码纯文本
program nba;
var
n,i,j,f,k:longint;
s,year,na:array[1..50] of string;
long:array[1..50] of longint;
t:string;
begin
assign(input,'nba.in');
reset(input);
assign(output,'nba.out');
rewrite(output);
readln(n);
for i:=1 to n do readln(s[i]);
for i:=1 to n do long[i]:=length(s[i]);
k:=0;
for i:=1 to n do
begin
for j:=1 to long[i] do
begin if copy(s[i],j,1)=' '
then
begin
k:=K+1;
if (copy(s[i],j+1,1)='1' )or(copy(s[i],j+1,1)='2')
then
begin
na[i]:=copy(s[i],1,j-1);
year[i]:=copy(s[i],j+1,long[i]);
end
else while (copy(s[i],j+1,1)<>'1')or(copy(s[i],j+1,1)<>'2') do
begin
na[i]:=concat(na[i],copy(s[i],k,j-1));
end;
end;
end;
end;
for i:= 1 to n-1 do
for j:= i+1 to n do
if year[i]>year[j] then
begin
t:=year[i]; year[i]:=year[j]; year[j]:=t;
t:=na[i]; na[i]:= na[j]; na[j]:=t;
end
else
if year[i]=year[j] then
for k:=j+1 to n do
begin
year[k-1]:=year[k];
na[k-1]:=na[k];
end;
for i:=1 to n do
writeln(year[i],' ',na[i]);
close(input);
close(output);
end.