Topcoder high school SRM 2 250 pt - Level one - Fountain Of Life editorial: http://community.topcoder.com/tc?module=Static&d1=hs&d2=match_editorials&d3=hs_srm2
Topcoder high school SRM 2 250 pt - Level one - Fountain Of Life solution:
#include <iostream> using namespace std; class FountainOfLife { public: double elixirOfDeath(int elixir, int poison, int pool) { if((poison < elixir) || ((poison==elixir) && pool>0)) return -1.0; else { double a=elixir, b=poison, c=pool; return c/(b-a); } } };
No comments:
Post a Comment