比赛 20130725暑期B班1测 评测结果 AAWWWT
题目名称 黑叔 最终得分 33
用户昵称 o_o 运行时间 1.024 s
代码语言 Pascal 内存使用 2.72 MiB
提交时间 2012-07-18 11:23:12
显示代码纯文本
var
a,b,c,d,e,r,t,m,n,o,i,j,w:longint;
k,l,h:array[0..10000]of longint;
s:array[0..10000]of string;
x,y,z,v:string;

begin
assign(input,'hey.in');
assign(output,'hey.out');
reset(input);
rewrite(output);
read(n);
for a:=1 to n do
begin
readln;
read(k[a],s[a]);
b:=length(s[a]);
x:=s[a];

for c:=b downto 1 do
if (ord(x[c])>47)and(ord(x[c])<58) then
begin

t:=1;
for d:=1 to b-c+1 do
t:=t*10;
l[a]:=l[a]+(ord(x[c])-48)*t div 10;
end
else


break;
end;

for i:=1 to n-1 do
for j:=i+1 to n do
if (k[i]>k[j])or((k[i]=k[j])and(s[i]>s[j])) then
begin
e:=k[i];
k[i]:=k[j];
k[j]:=e;
e:=l[i];
l[i]:=l[j];
l[j]:=e;
y:=s[i];
s[i]:=s[j];
s[j]:=y;
end;

for i:=1 to n do
begin

r:=1;

if l[i] div 10>0 then
r:=2;
if l[i] div 100>0 then
r:=3;
r:=r+1;
delete(s[i],1,1);
delete(s[i],length(s[i])-r+1,r+1);


end;







w:=k[1];
for a:=1 to n do
begin

write(s[a],' went out at time ',w);
w:=w+l[a];
writeln;
end;
close(input);
close(output);
end.