![[topcoder]LongLongTripDiv2 [topcoder]LongLongTripDiv2](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700)
http://community.topcoder.com/stat?c=problem_statement&pm=13091
解方程,对中国孩子太简单了。
#include <vector>
#include <iostream>
using namespace std; class LongLongTripDiv2 {
public:
string isAble(long long D, int T, int B) {
long long diff = (D - T);
if (diff % (B - 1) != 0)
return "Impossible";
long long b = diff / (B - 1);
long long a = T - b;
if (b >= 0 && a >= 0)
return "Possible";
return "Impossible";
}
};