My issue
Hello! The commented code works absolutely fine and covers all the test cases, but the code which I have written using ceil(), is failing the last test case. I can’t figure out the difference between the commented code and my code.
Kindly let me know why its not working. It would be better if you have example of such test case.
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int x,y,z;
cin>>x>>y>>z;
// if(y > z){
// if(y % z == 0){
// cout<<(y/z) * x<<endl;
// }
// else{
// cout<<(y/z + 1) * x<<endl;
// }
// }
// else{
// cout<<x<<endl;
// }
cout<< x * ceil((float)y / z) << endl;
}
return 0;
}
Problem Link: BOOKPACK Problem - CodeChef