結果
問題 | No.16 累乗の加算 |
ユーザー | kutsutama |
提出日時 | 2018-03-11 01:37:08 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 940 ms / 5,000 ms |
コード長 | 508 bytes |
コンパイル時間 | 431 ms |
コンパイル使用メモリ | 10,716 KB |
実行使用メモリ | 11,996 KB |
最終ジャッジ日時 | 2023-09-08 12:13:40 |
合計ジャッジ時間 | 7,331 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 49 ms
11,996 KB |
testcase_01 | AC | 49 ms
11,880 KB |
testcase_02 | AC | 940 ms
11,924 KB |
testcase_03 | AC | 237 ms
11,996 KB |
testcase_04 | AC | 302 ms
11,852 KB |
testcase_05 | AC | 395 ms
11,948 KB |
testcase_06 | AC | 624 ms
11,964 KB |
testcase_07 | AC | 538 ms
11,884 KB |
testcase_08 | AC | 746 ms
11,912 KB |
testcase_09 | AC | 845 ms
11,928 KB |
testcase_10 | AC | 667 ms
11,856 KB |
testcase_11 | AC | 46 ms
11,916 KB |
testcase_12 | AC | 556 ms
11,912 KB |
testcase_13 | AC | 289 ms
8,760 KB |
ソースコード
x, n = [int(s) for s in input().split()] a = [int(s) for s in input().split()] mod = 1000003 big = 100000 xx = [0] * (big + 1) xx[0] = 1 for e in range(1, big + 1): xx[e] = xx[e - 1] * x % mod res = 0 for ai in a: if ai > big: prod = 1 for e in range(ai // big): prod = prod * xx[big] % mod for e in range(ai % big): prod = prod * x % mod res = (res + prod) % mod else: res = (res + xx[ai]) % mod print(res)