結果

問題 No.487 2017 Calculation(2017の計算)
ユーザー Grenache
提出日時 2017-02-24 22:28:51
言語 Java
(openjdk 23)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 4,324 ms
コンパイル使用メモリ 77,640 KB
実行使用メモリ 54,640 KB
最終ジャッジ日時 2025-01-02 22:53:51
合計ジャッジ時間 6,354 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder487 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int m = sc.nextInt();

		long ret = 1;
		for (int i = 0; i < 2017; i++) {
			ret = ret * 2017 * 2017 % m;
		}

		ret += 2017;
		ret %= m;

		pr.println(ret);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0