Floor Number Codeforces Solution

Floor Number Codeforces Solution

In this post, the Floor Number Codeforces Solution is given. Here is the Question details : Codeforces Round #674 (Div. 3), problem: (A) Floor Number.

Floor Number Codeforces Solution

#include<bits/stdc++.h>
using namespace std;
const int MOD=1000000007;
#define ll long long
#define Fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define PB push_back
int main()
{
Fastio;
ll t; cin>>t;
while(t--)
{
ll n,x,i;
cin>>n>>x;
if(n==1 || n==2)
cout<<1<<endl;
else
{
for(i=0;i<=2000;i++)
{
if(n>=((i*x)+3) && n<=(((i+1)*x)+2))
{
cout<<i+2<<endl;
}
}
}
}
}


The solution of the above program is contributed by Vishal Vaibhab (IIT BHU). If you like TheCode11, then do follow us on Facebook, Twitter and Instagram.

Previous Post Next Post

Contact Form