// UVa 10223 - How many nodes ? #include <iostream> #include <map> using namespace std; #define integer unsigned long long int main() { map<integer, int> m; m[1] = 0; integer c = 1; for (int n = 0; c < 4294967295; n++) { c = (2 * (2 * n + 1) * c) / (n + 2); m[c] = n + 1; } integer n; while ((cin >> n) && n) cout << m[n] << endl; return 0; }
No comments:
Post a Comment