|
|
back to boardDiscussion of Problem 1607. Taxishortest solution contest //c++ #include <iostream> void main() { int ps,pu,ts,td,dif; std::cin>>ps>>pu>>ts>>td; dif=((ts=ps>ts?ps:ts)-ps)/(pu+td); std::cout<<(((ps+=(dif+1)*pu)<(ts-=dif*td))?ps:ts); } Re: shortest solution contest Posted by tk 11 Apr 2013 23:57 // Ruby a,b,c,d=gets.split.map { |x| x.to_i } e=((c=[a,c].max)-a)/(b+d) puts ((a+=(e+1)*b)<(c-=e*d)) ? a : c Edited by author 11.04.2013 23:58 |
|
|