Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
同问,贪心为什么WA?(我的程序见内)In Reply To:哪位大牛能帮我看看这个程序有什么错?我实在想不出什么数据了可以wa了…… Posted by:wangchen1ren at 2004-06-07 12:57:16 var map:array[1..10,1..10] of longint; s:array[1..10] of longint; t,ti,i,j,k,n:longint; f:boolean; begin readln(t); for ti:=1 to t do begin readln(n); for i:=1 to n do read(s[i]); readln; fillchar(map,sizeof(map),0); for i:=1 to n do if s[i]<>0 then for j:=1 to n do if i<>j then if s[j]<>0 then if map[i,j]=0 then begin dec(s[i]); dec(s[j]); map[i,j]:=1; map[j,i]:=1; if s[i]=0 then break; end; f:=true; for i:=1 to n do if s[i]<>0 then begin f:=false; break; end; if not f then writeln('NO') else begin writeln('YES'); for i:=1 to n do begin for j:=1 to n do write(map[i,j],' '); writeln; end; end; writeln; end; end. Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator