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