結果

問題 No.1299 Random Array Score
コンテスト
ユーザー universato
提出日時 2020-11-27 23:11:12
言語 Crystal
(1.19.1)
コンパイル:
crystal build -Donline_judge -o a.out --release --no-debug _filename_
実行:
./a.out
結果
AC  
実行時間 64 ms / 2,000 ms
+ 409µs
コード長 535 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 8,051 ms
コンパイル使用メモリ 347,020 KB
実行使用メモリ 30,592 KB
最終ジャッジ日時 2026-08-02 19:05:32
合計ジャッジ時間 11,096 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

lib C;fun strtoll(s: UInt8*,p: UInt8**,b: Int32): Int64;end
class String;def to_i64;C.strtoll(self,nil,10);end;end

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 }

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