309016: CF1612C. Chat Ban
Memory Limit:512 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Chat Ban
题意翻译
现在小A想发送一个 $2n-1$ 的符号三角形,具体如下: 第 $1$ 行,输出 $1$ 个符号; 第 $2\to n$ 行,每行比前一行多输出一个符号; 第 $n+1\to 2n−1$ 行,每一行比前一行少输出一个符号。 如果小A再发完某条信息后,所发送的符号总数大于等于 $k$ ,小 A 将会被禁言。 现在请你求出在小 A 被禁言前最多能发送的信息个数题目描述
You are a usual chat user on the most famous streaming platform. Of course, there are some moments when you just want to chill and spam something. More precisely, you want to spam the emote triangle of size $ k $ . It consists of $ 2k-1 $ messages. The first message consists of one emote, the second one — of two emotes, ..., the $ k $ -th one — of $ k $ emotes, the $ k+1 $ -th one — of $ k-1 $ emotes, ..., and the last one — of one emote. For example, the emote triangle for $ k=3 $ consists of $ 5 $ messages: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1612C/2949e1c874315434d0b3c1f5e20dee7c9097dc7a.png)Of course, most of the channels have auto moderation. Auto moderator of the current chat will ban you right after you spam at least $ x $ emotes in succession (you can assume you are the only user in the chat). Now you are interested — how many messages will you write before getting banned? Or maybe you will not get banned at all (i.e. will write all $ 2k-1 $ messages and complete your emote triangle successfully)? Note that if you get banned as a result of writing a message, this message is also counted. You have to answer $ t $ independent test cases.输入输出格式
输入格式
The first line of the input contains one integer $ t $ ( $ 1 \le t \le 10^4 $ ) — the number of test cases. The next $ t $ lines describe test cases. The only line of the test case contains integers $ k $ and $ x $ ( $ 1 \le k \le 10^9; 1 \le x \le 10^{18} $ ).
输出格式
For each test case, print the number of messages you will write before getting banned for the corresponding values $ k $ and $ x $ .
输入输出样例
输入样例 #1
7
4 6
4 7
1 2
3 7
2 5
100 1
1000000000 923456789987654321
输出样例 #1
3
4
1
4
3
1
1608737403