¶
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;
}
}










