My issue
I dont know neither do i understand whats going wrong in my approach
include <bits/stdc++.h>
using namespace std;
int main()
{
// your code goes here
int tc;
cin>>tc;
while(tc–)
{
int d,x,y;
cin>>d;
cin>>x;
cin>>y;
int ct=0;
while(x>y && x>0 && y>0)
{
ct++;
y–;
x=x-((xctd)/100);
}
if(x>y)
cout<<“-1”<<endl;
else
cout<<ct<<endl;
}
}
Can someone kindly help me out
My code
#include <bits/stdc++.h>
using namespace std;
int main()
{
// your code goes here
int tc;
cin>>tc;
while(tc--)
{
int d,x,y;
cin>>d;
cin>>x;
cin>>y;
int ct=0;
while(x>y && x>0 && y>0)
{
ct++;
y--;
x=x-((x*ct*d)/100);
}
if(x>y)
cout<<"-1"<<endl;
else
cout<<ct<<endl;
}
}
Problem Link: International Gym Day Practice Coding Problem