結果
| 問題 |
No.2300 Substring OR Sum
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2023-05-15 18:19:09 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 1,027 ms / 2,000 ms |
| コード長 | 216 bytes |
| コンパイル時間 | 100 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 29,952 KB |
| 最終ジャッジ日時 | 2024-11-30 23:07:32 |
| 合計ジャッジ時間 | 12,325 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
コンパイルメッセージ
Syntax OK
ソースコード
N = gets.to_i
A = gets.split.map(&:to_i)
ans = 0
30.times do |i|
base = 2 ** i
last = 0
A.each.with_index(1) do |a, idx|
if a[i] == 1
last = idx
end
ans += base * last
end
end
puts ans
siman