|
|
back to boardDiscussion of Problem 1607. TaxiShow all messages Hide all messagesWhy? n3v3r_die 18 Feb 2012 14:55 #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? Stefan Eniceicu 3 Jun 2012 15:42 "<=" and ">=" in those ifs. there is one more case where a >= c where you need to return a. |
|
|