You are viewing a single comment's thread. Return to all comments →
Can anyone tell what's wrong with my code ?
using namespace std;
long long a,b,d,ans; int main() { int t; cin >> t; while(t--) { ans =0; cin >> a >> b >> d; if(d>0) { if(d==min(a,b)||d==max(a,b)) {cout<<"1\n";continue;} ans = d/max(a,b); if(d%max(a,b)==min(a,b)) { ans++; } else if(d%max(a,b)!=0) ans+=2; } cout< return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Baby Step, Giant Step
You are viewing a single comment's thread. Return to all comments →
Can anyone tell what's wrong with my code ?
include
include
include
include
include
using namespace std;
long long a,b,d,ans; int main() { int t; cin >> t; while(t--) { ans =0; cin >> a >> b >> d; if(d>0) { if(d==min(a,b)||d==max(a,b)) {cout<<"1\n";continue;} ans = d/max(a,b); if(d%max(a,b)==min(a,b)) { ans++; } else if(d%max(a,b)!=0) ans+=2; } cout< return 0; }