문 ¶
2006-01-17 11:15:29 Accepted 0.000 Minimum 56031 C++ 10276 - Hanoi Tower Troubles Again!
:B(A,B,C), :높(낮,보,높), 벨:3(1~4)
:B(A,B,C), :높(낮,보,높), 벨:3(1~4)
¶
노 보는 런 문.
Closed Form 는 말 듣 봤
, Closed Form .
, Closed Form 면 딩 말 5 린 -.-;;
: 2n<sup>2</sup> - 1
: 2n<sup>2</sup> + 2n - 1
Closed Form 는 말 듣 봤
, Closed Form .
, Closed Form 면 딩 말 5 린 -.-;;
: 2n<sup>2</sup> - 1
: 2n<sup>2</sup> + 2n - 1
¶
딩 딸 맸 -.-;
부
부
¶
~cpp // Hanoi Tower Troubles Again // UVa ID : 10276 #include <iostream> using namespace std; int process(int input); int main() { int i, testCase, input; cin >> testCase; for (i = 0; i < testCase; i++) { cin >> input; cout << process(input) << endl; } return 0; } // closed form int process(int input) { // if ((input & 1) == 1) { input++; input /= 2; return 2 * input * input - 1; } else { input /= 2; return 2 * input * input + 2 * input - 1; } }