結果
問題 | No.487 2017 Calculation(2017の計算) |
ユーザー |
![]() |
提出日時 | 2017-08-19 09:49:19 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 583 bytes |
コンパイル時間 | 808 ms |
コンパイル使用メモリ | 103,108 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 21:41:49 |
合計ジャッジ時間 | 1,600 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 |
ソースコード
import std.algorithm; import std.array; import std.conv; import std.math; import std.range; import std.stdio; import std.string; import std.typecons; int readint() { return readln.chomp.to!int; } int[] readints() { return readln.split.map!(to!int).array; } long powmod(long x, long n, long mod) { if (n == 0) return 1 % mod; if (n % 2 == 0) return powmod((x * x) % mod, n / 2, mod); return (x * powmod(x, n - 1, mod)) % mod; } void main() { int m = readint(); auto ans = 2017 + (powmod(2017 * 2017, 2017, m)); writeln(ans % m); }