結果
問題 |
No.16 累乗の加算
|
ユーザー |
|
提出日時 | 2016-11-02 14:45:25 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 12 ms / 5,000 ms |
コード長 | 338 bytes |
コンパイル時間 | 194 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2024-06-26 05:17:42 |
合計ジャッジ時間 | 888 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 |
ソースコード
lst=[1] def calc(x,a): d=bin(a)[2:] ans=1 for i in xrange(len(d)): if d[i]=="1": ans*=lst[len(d)-i] return ans x,N=map(int,raw_input().split()) lst.append(x) for i in xrange(2,33): lst.append(lst[i-1]**2%1000003) a=map(int,raw_input().split()) ans=0 for i in xrange(N): ans+=calc(x,a[i]) ans=ans%1000003 print ans