結果

問題 No.16 累乗の加算
ユーザー tsuchinagatsuchinaga
提出日時 2019-03-26 15:45:37
言語 Go
(1.22.1)
結果
TLE  
実行時間 -
コード長 367 bytes
コンパイル時間 12,497 ms
コンパイル使用メモリ 218,680 KB
実行使用メモリ 6,912 KB
最終ジャッジ日時 2024-04-19 08:49:36
合計ジャッジ時間 18,652 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 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"
)

func main() {
	var x, y, n, a, ans int
	_, _ = fmt.Scan(&x, &n)
	mod := int(math.Pow10(6)) + 3
	// fmt.Println(mod)

	for i := 0; i < n; i++ {
		_, _ = fmt.Scan(&a)
		y = x
		if a == 0 {
			y = 1
		} else {
			for j := 1; j < a; j++ {
				y = (y * x) % mod
			}
		}
		// fmt.Println(x, a, y)
		ans += y
	}
	fmt.Println(ans)
}
0