結果
問題 |
No.16 累乗の加算
|
ユーザー |
|
提出日時 | 2014-11-16 08:09:45 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 93 ms / 5,000 ms |
コード長 | 307 bytes |
コンパイル時間 | 172 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,160 KB |
最終ジャッジ日時 | 2024-06-26 04:47:16 |
合計ジャッジ時間 | 2,210 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 |
コンパイルメッセージ
ruby: warning: shebang line ending with \r may cause problems Syntax OK
ソースコード
#!/usr/bin/ruby class Integer def pow_binary_mod(y,m) x = self z = 1 while y != 0 while y % 2 == 0 x = x * x % m y = y / 2 end y = y - 1 z = z * x % m end z end end x=gets.to_i p gets.split.map(&:to_i).map{|e|x.pow_binary_mod(e,1000003)}.reduce(:+)%1000003