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

Help me plizzzzz, My program works, but it's CRASHes when I send it!
Posted by волчонок 21 Jul 2005 08:27
 Please Help!
   Here is my code:
*******************************************************
var i,n,h,k:integer;

Procedure main;
 Begin
  readln(n);

    for i:=1 to n do begin
     readln(k);
     k:=k-1;
     h:=trunc(sqrt(2*k));
     if h*(h+1)=2*k then write('1 ') else write('0 ')
    end

End;

BEGIN

 main

END.
***********************************************************
Integer overflow. Use longword (-)
Posted by Dmitry 'Diman_YES' Kovalioff 21 Jul 2005 09:51
Re: Integer overflow. Use longword (-)
Posted by волчонок 21 Jul 2005 13:20
 Thank you very much!!!
Re: Integer overflow. Use longword (-)
Posted by Tolstobrov_Anatoliy[Ivanovo SPU] 22 Jul 2005 02:06

or Cardinal!!
:)
Re: Integer overflow. Use longword (-)
Posted by волчонок 22 Jul 2005 08:34
  Thanks!
     I used longword and got AC, but what is "Cardinal".
Re: Integer overflow. Use longword (-)
Posted by Tolstobrov_Anatoliy[Ivanovo SPU] 26 Jul 2005 00:46

CARDINAL = LONGWORD
sizeof(cardinal)=4
min(CARDINAL)=0
MAX(CARDINAL)=2^32-1

P.S. Сardinal синоним LongWord!!!
   Understand????
in server compiling with help FREEPASCAL!
(in UNIX or LINUX)
Re: Integer overflow. Use longword (-)
Posted by волчонок 27 Jul 2005 13:18
 Thank you, now I know what is CARDINAL!