hiho week 77 register

Ended

Participants:382

Verdict:Accepted
Score:100 / 100
Submitted:2015-12-21 16:17:32

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include<iostream>
using namespace std;
typedef long long ll;
int main()
{
    int num;
    while(cin>>num)
    {
        while(num--)
        {
            int n,i;
            cin>>i>>n;
            while(i>0&&n>0)
            {
                if((i&0x03)==0x02||(i&0x03)==0x03)
                    break;
                n--;
                i=((i-1)>>2)+1;
            }
            cout<<n<<endl;
        }
    }
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX