結果

問題 No.1299 Random Array Score
ユーザー universato
提出日時 2020-11-27 23:14:05
言語 Crystal
(1.14.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 413 bytes
コンパイル時間 11,250 ms
コンパイル使用メモリ 299,764 KB
実行使用メモリ 38,260 KB
最終ジャッジ日時 2024-06-30 21:46:41
合計ジャッジ時間 14,216 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

require "big"

struct Int
  def pow(n : Int, mod = nil ) : Int
    a = to_i64
    res = 1_i64
    while n > 0
      if (n & 1) != 0
        res *= a
        res %= mod if mod
      end
      a *= a
      a %= mod if mod
      n >>= 1
    end
    res
  end
end

mod = 998244353i64

n, k = gets.to_s.split.map{ |e| e.to_big_i }
a    = gets.to_s.split.map{ |e| e.to_big_i }

puts a.sum * 2.to_big_i.pow(k, mod) % mod
0