結果
| 問題 |
No.598 オーバーフローファンタジー
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-18 10:42:11 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 462 bytes |
| コンパイル時間 | 2,273 ms |
| コンパイル使用メモリ | 61,204 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-01 10:15:29 |
| 合計ジャッジ時間 | 3,282 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
template `min=`*(x,y) = x = min(x,y)
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
while true:
var k = getchar_unlocked()
if k < '0' or k > '9': break
else: result = 10 * result + k.ord - '0'.ord
let bit = scan()
let x = scan()
let a = scan()
let b = scan()
# x-n*a <= 0 :: x <= n*a :: n >= x/a
# x+n*b >= 2^31
var ans = 1 + (x-1) div a
ans .min= 1 + ((1 shl (bit-1)) - x - 1) div b
echo ans