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

Common Board

The Stupid Compiler: problem 1049
Posted by Alexander Kouprin 13 Feb 2007 22:41
Anybody can tell me what's wrong in this part of source? :)


["a part of source" deleted ;) ]


I think it's finder of simple numbers. And it's working correctly. Bcs I see 1229 simple numbers!!!

So, please tell me, how I can get "crash (integer overflow)"???
I know, I get this message in array "a", bcs when I write this:

var a:array[1..2000]of int64;

I get only WA#2!!!

P.S. Abnormally, first test working right!

Edited by moderator 13.02.2007 23:34
Re: The Stupid Compiler: problem 1049
Posted by diver[rus] 13 Feb 2007 23:32
Guess there should be
    for j:=1 to i do
instead of
    for j:=1 to c do
Re: The Stupid Compiler: problem 1049
Posted by Alexander Kouprin 14 Feb 2007 00:51
Not! You can't understand!
Do you know how find simple numbers fast? Must divide every number on all finding simple numbers!
So, artful moderator delete my source... It's no good... :)

a[1]:=2;
a[2]:=3;
c:=2;
for i:=5 to 10000 do begin
for j:=1 to c do
if i mod a[j]=0 then break;
if j=c+1 then begin
inc(c);
a[c]:=i;
end;
end;
for i:=1 to c do
writeln(a[i]);

This is my source!
Re: The Stupid Compiler: problem 1049
Posted by KIRILL(ArcSTU) 14 Feb 2007 01:11
Why do you think that after cycle j should be equal c+1
It's depend on compiler
if j=c+1 then begin //??
Re: The Stupid Compiler: problem 1049
Posted by diver[rus] 14 Feb 2007 02:11
Could you send me your full code? Your problem is a quite interesting, I'll try to test it..
My mail diver[dot]ru[at]gmail[dot]com
Re: The Stupid Compiler: problem 1049
Posted by Alexander Kouprin 14 Feb 2007 02:13
Really??
I always use this and never have any troubles...
On bpc/dcc32 compiler I always getting j=c+1, if cycle worked fulltime. But this...
So, now I test your idea.
Re: The Stupid Compiler: problem 1049
Posted by Alexander Kouprin 14 Feb 2007 02:17
Oh, thank you!
You really right!
I can't understand why, but now I know: only on Timus I must use special boolean variable for looking the end of cycle.
But it's stipud.