记录编号 | 218201 | 评测结果 | AAAAWWWWWW | ||
---|---|---|---|---|---|
题目名称 | 取余运算2 | 最终得分 | 40 | ||
用户昵称 | 是否通过 | 未通过 | |||
代码语言 | Pascal | 运行时间 | 0.002 s | ||
提交时间 | 2016-01-08 22:41:03 | 内存使用 | 0.17 MiB | ||
- var
- m:int64;
- n,x,k,ans:extended;
- begin
- assign(input,'helpless.in');
- reset(input);
- assign(output,'helpless.out');
- rewrite(output);
- read(n,m,k);
- n:=n-trunc(n/k)*k;
- x:=n;ans:=1;
- repeat
- if m and 1=1 then ans:=ans*x-trunc(ans*x/k)*k;
- x:=x*x-trunc(x*x/k)*k;m:=m shr 1;
- until m=0;
- writeln(trunc(ans));
- close(input);
- close(output);
- end.