记录编号 |
41123 |
评测结果 |
AAAAAT |
题目名称 |
[暑假培训2012] 黑叔 |
最终得分 |
83 |
用户昵称 |
o_o |
是否通过 |
未通过 |
代码语言 |
Pascal |
运行时间 |
1.021 s |
提交时间 |
2012-07-20 17:10:52 |
内存使用 |
25.72 MiB |
显示代码纯文本
var
a,b,c,d,e,r,t,m,n,o,i,j,w:longint;
k,l,h:array[0..100000]of longint;
s:array[0..100000]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
if w<k[a] then
begin
write(s[a],' went out at time ',k[a]);
w:=k[a]+l[a];
end
else
begin
write(s[a],' went out at time ',w);
w:=w+l[a];
end;
writeln;
end;
close(input);
close(output);
end.