Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

请大牛帮忙看看为什么WA?!

Posted by lylnoip2010 at 2010-09-30 13:38:55 on Problem 1579
var	f:array [0..20,0..20,0..20] of longint;
procedure work;
var	i,j,k:integer;
begin
	fillchar(f,sizeof(f),0);
	for i:=0 to 20 do
		for j:=0 to  20 do
		begin		
			f[0,i,j]:=1;
			f[i,0,j]:=1;
			f[i,j,0]:=1;
		end;
	for i:=1 to 20 do
		for j:=1 to 20 do
			for k:=1 to 20 do
				if (i<j) and (j<k) then f[i,j,k]:=f[i,j,k-1]+f[i,j-1,k-1]-f[i,j-1,k]
				else f[i,j,k]:=f[i-1,j,k]+f[i-1,j-1,k]+f[i-1,j,k-1]-f[i-1,j-1,k-1];
end;
procedure initprint;
var	a,b,c:longint;
		flag:boolean;
begin
		flag:=true;
		while flag do
		begin
			readln(a,b,c);
			if (a=-1) and (b=-1) and (c=-1) then flag:=false
			else
			begin
				if (a<=0) or (b<=0) or (c<=0) then writeln('w(',a,',',b,',',c,') = 1')
				else	 
					if (a>20) or (b>20) or (c>20) then writeln('w(',a,',',b,',',c,') = ',f[20,20,20])
					else	writeln('w(',a,',',b,',',c,') = ',f[a,b,c]);
			end;
		end;
end;
begin
	assign(input,'1579.in');
	assign(output,'1579.out');
	reset(input);
	rewrite(output);
	
	work;
	
	initprint;
	
	close(input);
	close(output);
end.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator