結果

問題 No.487 2017 Calculation(2017の計算)
ユーザー いともたやすく行われるえげつない行為
提出日時 2017-02-24 23:22:10
言語 Go
(1.23.4)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 377 bytes
コンパイル時間 17,888 ms
コンパイル使用メモリ 251,008 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-02 23:56:02
合計ジャッジ時間 17,231 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

// #C
// yukicoder no.487 main.go
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func solve(in io.Reader, out, err io.Writer) {
	m := 0
	fmt.Fscan(in, &m)
	a := 2017
	b := (a * a) % m
	c := 1
	for i := 0; i < 2017; i++ {
		c = (c * b) % m
	}
	fmt.Fprintln(out, (a%m+c)%m)
}

func main() {
	br := bufio.NewReaderSize(os.Stdin, int(1e7))
	solve(br, os.Stdout, os.Stderr)
}
0