結果
問題 |
No.16 累乗の加算
|
ユーザー |
|
提出日時 | 2018-12-23 23:45:09 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 608 bytes |
コンパイル時間 | 393 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-09-25 10:45:48 |
合計ジャッジ時間 | 8,060 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 14 |
ソースコード
import itertools x, a = map(int, input().split()) inpls = list(map(int,input().split())) def rem(x,n,d=1000003): if n == 0: return 1 else: ls = [2**i for i in range(0,20)] smls = [] smid = [] for i in range(1,21): for j in itertools.combinations(ls,i): sm = sum(j) if sm == n: smls.append(sm) smid.append(j) rm = 1 for i in list(smid[0]): r = x**i%d rm *= r return rm%d sm = 0 for i in inpls: sm += rem(x,i) print(sm%d)