My issue
I am getting answer in the example test case but this code is failing in a hidden test case… I’ve really tried everything but nothing seems to work… I’ve given 20 wrong submissions for this single problem
My code
#include<bits/stdc++.h>
using namespace std;
int main() {
int T;
cin >> T;
while (T--) {
int D, X, Y;
cin >> D >> X >> Y;
bool found = false;
double cost;
int budget;
for (int i = 0; i <= 100 / D; i++) {
budget = Y - i;
cost = X * (1.0 - (i * D) / 100.0);
if(budget<0){
break;
}
if (budget >= cost) {
cout << i << endl;
found = true;
break;
} else {
continue;
}
}
if (!found) {
cout << -1 << endl;
}
}
return 0;
}
Problem Link: International Gym Day Practice Coding Problem