Who can find the mistake???????????????????????????????? All right!I think. PROGRAM Ural1114; Var S:Extended; I,J,K,P,Q,N,A,B:Byte; F:Array[1..20,0..15,0..15] Of Extended; Begin ReadLN(N,A,B); FillChar(F,SizeOf(F),0); For I:=0 To A Do For J:=0 To B Do F[1,I,J]:=1; For I:=2 To N Do For J:=0 To A Do For K:=0 To B Do Begin For P:=0 To J Do For Q:=0 To K Do F[I,J,K]:=F[I,J,K]+F[I-1,P,Q]; End; S:=0; For I:=0 To A Do For J:=0 To B Do S:=S+F[N,I,J]; WriteLn(S:0:0); End. Change for this one : F[I,J,K]:=F[I,J,K]+F[I-1,J-P,K-Q]; > All right!I think. > PROGRAM Ural1114; > Var > S:Extended; > I,J,K,P,Q,N,A,B:Byte; > F:Array[1..20,0..15,0..15] Of Extended; > Begin > ReadLN(N,A,B); > FillChar(F,SizeOf(F),0); > For I:=0 To A Do > For J:=0 To B Do F[1,I,J]:=1; > For I:=2 To N Do > For J:=0 To A Do > For K:=0 To B Do > Begin > For P:=0 To J Do > For Q:=0 To K Do F[I,J,K]:=F[I,J,K]+F[I- 1,P,Q]; > End; > S:=0; > For I:=0 To A Do > For J:=0 To B Do > S:=S+F[N,I,J]; > WriteLn(S:0:0); > End. |