-
Notifications
You must be signed in to change notification settings - Fork 2
/
que1.txt
85 lines (73 loc) · 1.59 KB
/
que1.txt
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define inf LLONG_MAX
ll isPrime(int n)
{
// Corner cases
if (n <= 1)
return 1;
if (n <= 3)
return 2;
// This is checked so that we can skip
// middle five numbers in below loop
if (n % 2 == 0 || n % 3 == 0)
return 1;
for (int i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0)
return 1;
return 2;
}
ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i,res%=1000000007;
return res; }
int gcd(int a, int b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
ll findlcm(ll arr[], int n)
{
ll ans = arr[0];
for (int i = 1; i < n; i++)
ans = (((arr[i] * ans)) /
(gcd(arr[i], ans)));
return ans;
}
bool sortbysec(const pair<pair<string,int>,int> &a,
const pair<pair<string,int>,int> &b)
{
if(a.first.first==b.first.first)
return a.first.second > b.first.second;
return (a.first.first < b.first.first);
}
bool checkValidity(ll a, ll b, ll c)
{
// check condition
if (a + b <= c || a + c <= b || b + c <= a)
return false;
else
return true;
}
int main()
{
fast;
ll t;
cin>>t;
while(t--)
{
double n,x;
cin>>n>>x;
if(n<=2)
{
cout<<"1"<<endl;
}
else{
double ans=1;
cout<<ans+ceil((n-2)/x)<<endl;
}
}
return 0;
}