시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 637 447 393 71.846%

문제

n번째 삼각수, T(n)은 1부터 n까지의 합이다. T(n) = 1 + ... + n. 이것은 삼각형 모양으로 표현할 수 있다. 아래 그림은 T(4)를 나타낸 것이다.

다음과 같은 식을 통해 가중치를 부여한 삼각수의 합을 구할 수 있다.

W(n) = Sum[k=1..n; k*T(k+1)]

n이 주어졌을 때, W(n)을 구하는 프로그램을 작성하시오.

입력

첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 정수 n 하나로 이루어져 있다. (1<=n<=300)

출력

각 테스트 케이스에 대해 W(n)을 한 줄에 하나씩 출력한다.

예제 입력 1

4
3
4
5
10

예제 출력 1

45
105
210
2145
W3sicHJvYmxlbV9pZCI6IjI3MjEiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWMwYmNcdWFjMDFcdWMyMThcdWM3NTggXHVkNTY5IiwiZGVzY3JpcHRpb24iOiI8cD5uXHViYzg4XHVjOWY4IFx1YzBiY1x1YWMwMVx1YzIxOCwgVChuKVx1Yzc0MCAxXHViZDgwXHVkMTMwIG5cdWFlNGNcdWM5YzBcdWM3NTggXHVkNTY5XHVjNzc0XHViMmU0LiBUKG4pID0gMSArIC4uLiArIG4uIFx1Yzc3NFx1YWM4M1x1Yzc0MCBcdWMwYmNcdWFjMDFcdWQ2MTUgXHViYWE4XHVjNTkxXHVjNzNjXHViODVjIFx1ZDQ1Y1x1ZDYwNFx1ZDU2MCBcdWMyMTggXHVjNzg4XHViMmU0LiBcdWM1NDRcdWI3OTggXHVhZGY4XHViOWJjXHVjNzQwIFQoNClcdWI5N2MgXHViMDk4XHVkMGMwXHViMGI4IFx1YWM4M1x1Yzc3NFx1YjJlNC48XC9wPlxyXG5cclxuPHA+PGltZyBhbHQ9XCJcIiBzcmM9XCJcL3VwbG9hZFwvaW1hZ2VzXC90c3VtLnBuZ1wiIHN0eWxlPVwiaGVpZ2h0Ojkwc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yB0aGF0IGZvbGxvdy4mbmJzcDs8XC9wPlxyXG5cclxuPHA+RWFjaCBkYXRhc2V0IGNvbnNpc3RzIG9mIGEgc2luZ2xlIGxpbmUgb2YgaW5wdXQgY29udGFpbmluZyBhIHNpbmdsZSBpbnRlZ2VyIG4sICgxICZsZTsgbiAmbGU7MzAwKSwgd2hpY2ggaXMgdGhlIG51bWJlciBvZiBwb2ludHMgb24gYSBzaWRlIG9mIHRoZSB0cmlhbmdsZS48XC9wPlxyXG4iLCJvdXRwdXQiOiI8cD5Gb3IgZWFjaCBkYXRhc2V0LCBvdXRwdXQgb24gYSBzaW5nbGUgbGluZSB0aGUgZGF0YXNldCBudW1iZXIsICgxIHRocm91Z2ggTiksIGEgYmxhbmssIHRoZSB2YWx1ZSBvZiBuIGZvciB0aGUgZGF0YXNldCwgYSBibGFuaywgYW5kIHRoZSB3ZWlnaHRlZCBzdW0gLCBXKG4pLCBvZiB0cmlhbmd1bGFyIG51bWJlcnMgZm9yIG4uPFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsInByb2JsZW1fbGFuZ19jb2RlIjoiXHVjNjAxXHVjNWI0In1d

출처

ACM-ICPC > Regionals > North America > Greater New York Region > 2006 Greater New York Programming Contest B번