結果

問題 No.604 誕生日のお小遣い
ユーザー むらためむらため
提出日時 2019-01-18 09:51:31
言語 Nim
(2.0.2)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 712 bytes
コンパイル時間 853 ms
コンパイル使用メモリ 73,688 KB
最終ジャッジ日時 2024-04-27 02:46:28
合計ジャッジ時間 1,308 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
/home/judge/data/code/Main.nim(2, 28) Error: cannot open file: queues

ソースコード

diff #

import sequtils,strutils,algorithm,math,sugar,macros,strformat
import sets,tables,intsets,queues,heapqueue,bitops
template get*():string = stdin.readLine().strip()
macro unpack*(arr: auto,cnt: static[int]): auto =
  let t = genSym(); result = quote do:(let `t` = `arr`;())
  for i in 0..<cnt: result[1].add(quote do:`t`[`i`])

let (a,b,c) = get().split().map(parseInt).unpack(3)
proc f(x:int) : int =
  const tooBig = (4e18.int).fastLog2()
  let s =  a+b-1
  let t = x div a
  if t > 1 and fastLog2(s) + fastLog2(t) > tooBig : return 4e18.int
  return x mod a + s * t
var x = 1
var y = 1e18.int + 10
while true:
  if c <= f(y) and f(y-1) < c: quit $y,0
  let m = (x+y) div 2
  if f(m) < c : x = m
  else : y = m
0