Responsive image

Problem H: 讨厌洗袜子

Problem H: 讨厌洗袜子

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 59  Solved: 24
[Submit][Status][Web Board][Creator:]

Description

hh有n双袜子,编号从1~n,每天穿编号最小的一双,当穿到最后一双时,把前面袜子都洗了,然后再按编号最小的开始穿。问你第k天穿的编号是多少。

Input

多组测试样例,每组样例输入一个n和一个k(1<n<=100000,1<=k<=1e18)

Output

每组样例输入第k天穿的袜子编号

Sample Input

3 7
3 6
4 9

Sample Output

3
1
2
[Submit][Status]
ACM算法攻关部
  • Anything about this OnlineJudge, Please Contact Administrator. Click add QQ

    OJ system based on HUSTOJ Project , UI based on Twitter Bootstrap

    Copyright 2016 ACM算法攻关部
    关于网站改版