首页 > 试题广场 >

const c = 2009; var n, p, s,

[填空题]
const c = 2009;
var
  n, p, s, i, j, t: integer;
begin
  read(n, p);
  s := 0; t := 1;
  for i := 1 to n do
  begin
    t := t * p mod c;
    for j := 1 to i do
      s := (s + t) mod c;
  end;
  writeln(s);
end.

输入:11 2
输出:1

这道题你会答吗?花几分钟告诉大家答案吧!