結果
| 問題 | 
                            No.16 累乗の加算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             toshiro_yanagi
                         | 
                    
| 提出日時 | 2018-06-19 20:28:06 | 
| 言語 | Nim  (2.2.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 392 bytes | 
| コンパイル時間 | 3,391 ms | 
| コンパイル使用メモリ | 66,660 KB | 
| 実行使用メモリ | 9,504 KB | 
| 最終ジャッジ日時 | 2024-06-30 17:18:42 | 
| 合計ジャッジ時間 | 10,077 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 2 RE * 11 TLE * 1 | 
ソースコード
import strutils, sequtils, math
const
  M = 10 ^ 6 + 3
let
  xN, a = stdin.readLine.split.map parseInt
  (x, N) = (xN[0], xN[1])
var
  ttl = newSeq[int](N)
for i, ai in a:
  var j = 0
  while x ^ j < int.high div x:
    j += 1
  let j0 = j - 1
  var y = 1
  for j in 0 ..< (ai div j0):
    y *= ((x ^ j0) mod M) mod M
  y *= x ^ (ai mod j0)
  y = y mod M
  ttl[i] = y
echo ttl.sum mod M
            
            
            
        
            
toshiro_yanagi