[算法] 算上广场
{$MODE OBJFPC} program SquareCounter; const InputFile = 'SQUARES.INP'; OutputFile = 'SQUARES.OUT'; m = 2013; var fi, fo: TextFile; n: Int64; x: array[1..3] of Int64; i: Integer; res: Int64; begin AssignFile(fi, InputFile); Reset(fi); AssignFile(fo, OutputFile); Rewrite(fo); try while not SeekEof(fi) do begin ReadLn(fi, n); x[1] := n; x[2] := n + 1; x[3] := 2 * n + 1; for i := 1 to 3 do if x[i] mod 2 = 0 then begin x[i] := x[i] div 2; Break; end; for i := 1 to 3 do if x[i] mod 3 = 0 then begin x[i] := x[i] div 3; Break; end; res := (x[1] mod m) * (x[2] mod m) * (x[3] mod m) mod m; WriteLn(fo, res); end; finally CloseFile(fi); CloseFile(fo); end; end.
他们希望你读这篇文章,并认为解决方案推荐, 然后看看你的答案,然后观看代码应设在多个地点,我也相信你不会想读一遍建议即时答案.
页面 4 将谈论一些事情,并扩大在公式中我们所有的人:
最新评论