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...

whi wrang help me please it is all good in formul
Posted by I am david. Tabo. 21 Oct 2002 23:46
var q,i,j,k,l,m,n,b:longint;
    v:integer;
    a:array [1..200000] of longint;
    x:real;
    s,s1:string;

begin
  readln (n);
  for i:=1 to n do
    begin
      readln (j);
      x:=sqrt(1+8*(j-1));
      str(x,s);
      for m:=2 to length(s) do
        begin
          if (s[m]='.')and(k<>1) then
            k:=1
          else
            s1:=s1+s[m];
          if k=1 then
            break;
        end;
      k:=0;
      inc(q);
      val (s1,b,v);
      if b*b=(1+8*(j-1)) then
        k:=1;
      if k=0 then
        a[q]:=0
      else
        a[q]:=1;;
      k:=0;
      s1:='';
    end;
  writeln;
  write(a[1],' ');
  for i:=2 to q do
    write(' ',a[i],' ');
end.
Re: whi wrang help me please it is all good in formul
Posted by Danilchenko Anton 22 Oct 2002 04:07
0+1+2+...+N=N*(N+1)/2 - it's a very easy!!!