문 ¶
2006-01-17 09:55:33 Accepted 0.002 Minimum 56031 C++ 10276 - Hanoi Tower Troubles Again!
감 ¶
노 라고 보기는 그런 문다.
기 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
려던 ¶
결국 고딩 딸려 맸다 -.-;
공부 다 ㅋㅋ
공부 다 ㅋㅋ
드 ¶
// 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;
}
}










