結果
問題 | No.1243 約数加算 |
ユーザー |
|
提出日時 | 2022-01-26 16:31:07 |
言語 | Scala(Beta) (3.6.2) |
結果 |
AC
|
実行時間 | 1,115 ms / 2,000 ms |
コード長 | 637 bytes |
コンパイル時間 | 13,627 ms |
コンパイル使用メモリ | 256,732 KB |
実行使用メモリ | 63,832 KB |
最終ジャッジ日時 | 2024-12-23 07:41:20 |
合計ジャッジ時間 | 25,931 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
import scala.annotation.tailrecimport scala.collection.mutable.ArrayBufferimport scala.io.StdIn.*import scala.math.*@main def main =val testCase = readLine().toIntfor _ <- 0 until testCase doval Array(a, b) = readLine().split(' ').map(_.toLong)var current = aval op = ArrayBuffer[Long]()for i <- 0 until 60 doval d = 1L << iif (current & d) != 0L && current + d <= b thencurrent += dop.addOne(d)for i <- 59 to 0 by -1 doval d = 1L << iif current + d <= b thencurrent += dop.addOne(d)println(op.length)println(op.mkString(" "))