|
|
back to boardDiscussion of Problem 1607. TaxiWhy? #include <iostream> using namespace std; int taxi(int a,int b,int c,int d){ if ((a+b)>c) {return c;} a+=b; if ((c-d)<a) return a; c-=d; taxi(a,b,c,d); } int main() { int a,b,c,d; cin>>a>>b>>c>>d; cout<<taxi(a,b,c,d); return 0; } Wrong answer test #1 Re: Why? "<=" and ">=" in those ifs. there is one more case where a >= c where you need to return a. |
|
|