結果
| 問題 |
No.1869 Doubling?
|
| コンテスト | |
| ユーザー |
ID 21712
|
| 提出日時 | 2025-06-09 22:24:42 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 415 bytes |
| コンパイル時間 | 11,878 ms |
| コンパイル使用メモリ | 242,740 KB |
| 実行使用メモリ | 7,840 KB |
| 最終ジャッジ日時 | 2025-06-09 22:24:56 |
| 合計ジャッジ時間 | 13,502 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 WA * 9 |
ソースコード
package main
import . "fmt"
import . "sort"
func main() {
var n, m int
Scan(&n,&m)
x := Search(m, func(i int) bool {
j := i+1
c := 0
for j > 1 {
c++
if j % 2 == 0 {
j /= 2
} else {
j = (j+1)/2
}
}
return n - c < 0
})
x = min(m, max(1, x))
s, c := 0, 0
for x > 1 {
s += x
c++
if x % 2 == 0 {
x /= 2
} else {
x = (x+1)/2
}
}
ans := s + (n-c)
Println(ans)
}
ID 21712