|
|
вернуться в форумWho can give me some tests? Послано BYF 9 ноя 2002 18:47 Re: Who can give me some tests? > for all numbers of form n*(n+1)/2+n+2 the answer is 1 and for the the others is 0 Re: Who can give me some tests? > for all numbers of form n*(n+1)/2+n+2 the answer is 1 and for the the others is 0 Then why my program always get WA? Послано BYF 10 ноя 2002 08:12 Program Ural1209; Const Max=65536; Var Num:Array[0..Max] Of Longint; T:Array[1..Max] Of Byte; N,I,K,J,M:Longint; Begin I:=0; K:=0; J:=0; M:=0; FillChar(T,SizeOf(T),0); FillChar(Num,SizeOf(Num),0); Num[0]:=1; For I:=1 To Max Do Num[I]:=Num[I-1]+I; Readln(N); For I:=1 To N Do Begin Readln(K); If K<1000000000 Then M:=Trunc(Sqrt(K*2)) Else M:=Trunc(Sqrt(K)); If K>Num[Max] Then Begin T[I]:=0; Break; End; For J:=M-1 To Max-1 Do Begin If (K>Num[J]) And (K<Num[J+1]) Then Begin T[I]:=0; Break; End Else If (Num[J]=K) Or (Num[J+1]=K) Then Begin T[I]:=1; Break; End; End; End; For I:=1 To N Do If I<>N Then Write(T[I],' ') Else Write(T[I]); End. Re: Then why my program always get WA? I have no idea the same thing hapens to me too here 's my formula :-) Послано ss 11 ноя 2002 19:04 if sum (sqtr(2*(K-1))) + 1 == K then K==1 else K==0 Re: Who can give me some tests? I have WA3? Why???? Послано SP2 5 мар 2007 17:31 Re: Who can give me some tests? I have WA3? Why???? Послано vitar 22 мар 2007 22:26 1250025001 result 1. |
|
|