NOIP2010T4 三国游戏

 

 

var
    a:array[1..500,1..500]of longint;
    i,j,n,mj,max:longint;
begin
    assign(input,'sanguo.in'); reset(input);
    assign(output,'sanguo.out'); rewrite(output);
    readln(n);
    for i:=1 to n-1 do
        for j:=i+1 to n do
        begin
            read(a[i,j]);
            a[j,i]:=a[i,j];
        end;
    for i:=1 to n do
    begin
        max:=a[i,1]; mj:=1;
        for j:=2 to n do
            if a[i,j]>max then begin max:=a[i,j]; mj:=j; end;
        a[i,mj]:=0;
    end;
    max:=0;
    for i:=1 to n do
        for j:=1 to n do
            if a[i,j]>max then max:=a[i,j];
    writeln(1);  //小涵必胜,所以输出“1”
    writeln(max);  //输出次大值中的最大值
    close(input); close(output);
end.

 

posted @ 2013-10-24 15:36  qilinart  阅读(397)  评论(0编辑  收藏  举报