fork download
  1. uses math;
  2. const
  3. maxN =5*trunc(1e4)+1;
  4. base =trunc(1e9) + 7;
  5. type
  6. ansi = AnsiString;
  7. var
  8. ff, gg: text; i: longint;
  9. S: ansi;
  10. n: longint;
  11.  
  12. pow: array[0..maxN] of int64;
  13. hash: array[0..maxN] of int64;
  14.  
  15. function getHash(i, j: longint): int64;
  16. begin
  17. getD:= (hash[j]-hash[i-1]*pow[j-i+1] + base*base) mod base;
  18. end;
  19.  
  20. begin
  21. // n = length(S);
  22. pow[0]:= 1;
  23. for i:= 1 to N do pow[i]:=(pow[i-1]*26) mod base;
  24.  
  25. for i:= 1 to N do hash[i]:= (hash[i-1]*26 + ord(S[i]) - ord('a'))mod base;
  26. end.
  27.  
  28.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.pas:1: warning: missing program header
prog.pas:1: error: module/unit interface `math' could not be imported
stdout
Standard output is empty