level 1
jyrth
楼主
type
q=record
yw:integer;
sx:integer;
yw1:integer;
xxx:integer;
end;
var a,b,c,e,g,n:integer;
z:array [1..1000] of q;
x:array [1..1000] of 1..1000;
y:array [1..1000] of 1..120;
w:array [1..1000] of integer;
procedure p(o:integer); begin
for a:=1 to n-1 do
begin
c:=a;
for b:=a+1 to n do
if w<w[c] then c:=b;
if c<>a then
begin
g:=w[a];
w[a]:=w[c];
w[c]:=g;
e:=x[a];
x[a]:=x[c];
x[c]:=e;
end;
end;
end;
begin
readln(n);
for a:=1 to n do
readln(z[a].yw,z[a].sx,z[a].yw1,z[a].xxx);
for a:=1 to n do
y[a]:=z[a].sx;
for a:=1 to n do
w[a]:=w[a]+y[a];
for a:=1 to n do
x[a]:=a;
p(w[a]);
for a:=1 to n do
y[a]:=z[a].xxx;
for a:=1 to n do
w[a]:=w[a]+y[a];
for a:=1 to n do
x[a]:=a;
p(w[a]);
for a:=1 to n do
y[a]:=z[a].xxx;
for a:=1 to n do
w[a]:=w[a]+y[a];
for a:=1 to n do
r[a]:=a;
p(w[a]);
for a:=1 to n do
writeln(z[a].yw,' ',z[a].sx,' ',z[a].yw1,' ',z[a].xxx,x[a],' ',r[a])
end.
2013年08月14日 02点08分
1
q=record
yw:integer;
sx:integer;
yw1:integer;
xxx:integer;
end;
var a,b,c,e,g,n:integer;
z:array [1..1000] of q;
x:array [1..1000] of 1..1000;
y:array [1..1000] of 1..120;
w:array [1..1000] of integer;
procedure p(o:integer); begin
for a:=1 to n-1 do
begin
c:=a;
for b:=a+1 to n do
if w<w[c] then c:=b;
if c<>a then
begin
g:=w[a];
w[a]:=w[c];
w[c]:=g;
e:=x[a];
x[a]:=x[c];
x[c]:=e;
end;
end;
end;
begin
readln(n);
for a:=1 to n do
readln(z[a].yw,z[a].sx,z[a].yw1,z[a].xxx);
for a:=1 to n do
y[a]:=z[a].sx;
for a:=1 to n do
w[a]:=w[a]+y[a];
for a:=1 to n do
x[a]:=a;
p(w[a]);
for a:=1 to n do
y[a]:=z[a].xxx;
for a:=1 to n do
w[a]:=w[a]+y[a];
for a:=1 to n do
x[a]:=a;
p(w[a]);
for a:=1 to n do
y[a]:=z[a].xxx;
for a:=1 to n do
w[a]:=w[a]+y[a];
for a:=1 to n do
r[a]:=a;
p(w[a]);
for a:=1 to n do
writeln(z[a].yw,' ',z[a].sx,' ',z[a].yw1,' ',z[a].xxx,x[a],' ',r[a])
end.