ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Общий форум

The Stupid Compiler: problem 1049
Послано Alexander Kouprin 13 фев 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
Послано diver[rus] 13 фев 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
Послано Alexander Kouprin 14 фев 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
Послано KIRILL(ArcSTU) 14 фев 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
Послано diver[rus] 14 фев 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
Послано Alexander Kouprin 14 фев 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
Послано Alexander Kouprin 14 фев 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.