405375: GYM101917 H Diego and drinks

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Diego and drinkstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Today is 4th of july and because of that Diego is celebrating with his friends, they are all drinking their favorite drink in a cup made out of glass. Glass has a property that when you touch it with another thing made out of glass they will produce a sound "clink!". Everytime that someone opens up a drink they go and touch everybody else's drink, each person drinks at their own pace and as soon as they finish their drink they grab another one and "clink!" everyone in the party before anybody else finishes their drink. You can assume that everyone always has a drink and that in the beginning all of them grabbed drinks then "clink!" each other once. Diego knows 2 things, he has N friends in the party and he heard exactly K "clink!"s

Input

T an integer T (1<=T<=$$$10{^5}$$$), the amount of 4th of july parties that Diego went to.

Followed by T lines, each with 2 integers N (1<=N<=$$$10{^4}$$$) and K (0<=K<=$$$10{^9}$$$).

Output

1 integer for each test case, the amount of drinks that people drank in the party. If it's not possible to get that amount of "clink!"s then output "Too drunk to count"

ExampleInput
5
1 1
2 5
2 6
3 15
1 0
Output
2
4
Too drunk to count
7
Too drunk to count

Source/Category

加入题单

上一题 下一题 算法标签: