結果

問題 No.16 累乗の加算
ユーザー warashiwarashi
提出日時 2015-06-01 20:53:44
言語 Go
(1.22.1)
結果
TLE  
実行時間 -
コード長 349 bytes
コンパイル時間 15,023 ms
コンパイル使用メモリ 235,632 KB
実行使用メモリ 40,832 KB
最終ジャッジ日時 2024-04-19 02:19:53
合計ジャッジ時間 18,380 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
40,832 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"math/big"
)

func main() {
	var N int
	var x, a int64
	fmt.Scan(&x, &N)
	X := big.NewInt(x)
	ans := big.NewInt(0)
	mod := big.NewInt(1000003)
	tmp := big.NewInt(0)
	for i := 0; i < N; i++ {
		fmt.Scan(&a)
		A := big.NewInt(a)
		ans = ans.Add(ans, tmp.Exp(X, A, nil))
	}
	ans.DivMod(ans, mod, tmp)
	fmt.Println(tmp)
}
0