|
|
вернуться в форумОбщий форумThe Stupid Compiler: problem 1049 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 Guess there should be for j:=1 to i do instead of for j:=1 to c do Re: The Stupid Compiler: problem 1049 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 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 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 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 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. |
|
|