ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1209. 1, 10, 100, 1000...

Who can give me some tests?
Posted by BYF 9 Nov 2002 18:47
Re: Who can give me some tests?
Posted by Fechete Dan Ionut[dany] 9 Nov 2002 21:25
> 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?
Posted by Fechete Dan Ionut[dany] 9 Nov 2002 21:26
> 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?
Posted by BYF 10 Nov 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?
Posted by Fechete Dan Ionut[dany] 10 Nov 2002 19:26
I have no idea the same thing hapens to me too
here 's my formula :-)
Posted by ss 11 Nov 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????
Posted by SP2 5 Mar 2007 17:31
Re: Who can give me some tests? I have WA3? Why????
Posted by vitar 22 Mar 2007 22:26
1250025001

result 1.