My issue
#include<bits/stdc++.h>
define ll long long
using namespace std;
int main()
{
int t;
cin >> t;
while (t–)
{
ll x,y,k;
cin>>x>>y>>k;
ll a=x;
ll ans=0;
while(a!=y)
{
if(ak>y)
{
ans+=y-a;
break;
}
else
{
if((a+1)k==y)
{
a++;
ans++;
continue;
}
if(ak<=y)
{
a=ak;
ans++;
}
else
{
a++;
ans++;
}
}
}
cout<<ans<<“\n”;
}
return 0;
}
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
}
Problem Link: Change A to B Practice Coding Problem