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 1219. Symbolic Sequence

Korduban [Kiev] Why "Crash (ACCESS_VIOLATION)" on first test? (+) [3] // Problem 1219. Symbolic Sequence 18 Aug 2004 15:02
Here is my program:

{$I-,Q-,R-,S-}
var
  ch:char;
  i,x:longint;
  s:array[1..5] of longint;
function mrandom:integer;
begin
  x:=(s[1]+s[2]+s[3]+s[4]+s[5]) mod $1000001;
  s[1]:=s[2];
  s[2]:=s[3];
  s[3]:=s[4];
  s[4]:=s[5];
  s[5]:=x;
  mrandom:=trunc((x/$1000001)*26);
end;
begin
  s[1]:=99838134;
  s[2]:=38475378;
  s[3]:=23746254;
  s[4]:=23452673;
  s[5]:=23462343;
  for i:=1 to 1000000 do
    write(chr(ord('a')+mrandom));
end.

I am very surprised...
Macarie programatorul in actiune Re: Why "Crash (ACCESS_VIOLATION)" on first test? (+) [1] // Problem 1219. Symbolic Sequence 18 Aug 2004 21:57
i submit it and got AC :P
and I got AC too... It's strange
as you see this simple code get AC
it's the power of randomize!!!!!

var i : longint;
begin
  randomize;
  for i:=1 to 1000000 do
    write(chr(random(26)+ord('a')));
  writeln;
end.