시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 1094 847 773 79.773%

문제

리처드 필립스 파인만은 노벨 물리학상을 수상한 미국의 물리학자이다. 그는 이론물리학을 연구했고, 양자 컴퓨팅 분야를 개척했다. "Surely You’re Joking, Mr. Feynman!", "What Do You Care What Other People Think?"와 같은 그의 책은 많은 사람들의 사랑을 받았고, 한국에도 번역되어 출판되어져 있다. 그는 오랜 기간동안 퍼즐, 자물쇠, 암호를 만들고 푸는 일에 중독되어 있었다. 

어느 날, 남아메리카의 한 농장에서 파인먼의 것으로 추정되는 한 메모가 발견되었다. 퍼즐은 이 메모에는 중간자와 전자기에 대한 내용이 적혀있었고, 가장 마지막 줄에는 다음과 같은 퀴즈가 적혀져 있었다. "N × N 정사각형으로 이루어진 그리드에는 서로 다른 정사각형이 몇 개나 있을까요?" 이 퀴즈의 정답을 구하는 프로그램을 작성하시오.

N = 2인 경우에 정답은 5이다.

입력

입력은 여러 개의 테스트 케이스로 이루어져 있다. 각 테스트 케이스는 한 줄로 이루어져 있고, 그리드 한 변에 있는 정사각형의 개수 N이 주어진다. (1 ≤ N ≤ 100)

입력의 마지막 줄에는 0이 하나 주어진다.

출력

각 테스트 케이스에 대해서, 한 줄에 하나씩 서로 다른 정사각형의 개수를 출력한다.

예제 입력 1

2
1
8
0

예제 출력 1

5
1
204
W3sicHJvYmxlbV9pZCI6IjU3MjQiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWQzMGNcdWM3NzhcdWI5Y2MiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YjlhY1x1Y2M5OFx1YjRkYyBcdWQ1NDRcdWI5YmRcdWMyYTQgXHVkMzBjXHVjNzc4XHViOWNjXHVjNzQwIFx1YjE3OFx1YmNhOCBcdWJiM2NcdWI5YWNcdWQ1NTlcdWMwYzFcdWM3NDQgXHVjMjE4XHVjMGMxXHVkNTVjIFx1YmJmOFx1YWQ2ZFx1Yzc1OCBcdWJiM2NcdWI5Y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udGFpbnMgc2V2ZXJhbCB0ZXN0IGNhc2VzLiBFYWNoIHRlc3QgY2FzZSBpcyBjb21wb3NlZCBvZiBhIHNpbmdsZSBsaW5lLCBjb250YWluaW5nIG9ubHkgb25lIGludGVnZXIgTiwgcmVwcmVzZW50aW5nIHRoZSBudW1iZXIgb2Ygc3F1YXJlcyBpbiBlYWNoIHNpZGUgb2YgdGhlIGdyaWQgKDEgJmxlOyBOICZsZTsgMTAwKS48XC9wPlxyXG5cclxuPHA+VGhlIGVuZCBvZiBpbnB1dCBpcyBpbmRpY2F0ZWQgYnkgYSBsaW5lIGNvbnRhaW5pbmcgb25seSBvbmUgemVyby48XC9wPlxyXG5cclxuPHA+VGhlIGlucHV0IG11c3QgYmUgcmVhZCBmcm9tIHN0YW5kYXJkIGlucHV0LjxcL3A+XHJcbiIsIm91dHB1dCI6IjxwPkZvciBlYWNoIHRlc3QgY2FzZSBpbiB0aGUgaW5wdXQsIHlvdXIgcHJvZ3JhbSBtdXN0IHByaW50IGEgc2luZ2xlIGxpbmUsIGNvbnRhaW5pbmcgdGhlIG51bWJlciBvZiBkaWZmZXJlbnQgc3F1YXJlcyBmb3IgdGhlIGNvcnJlc3BvbmRpbmcgaW5wdXQuPFwvcD5cclxuXHJcbjxwPlRoZSBvdXRwdXQgbXVzdCBiZSB3cml0dGVuIHRvIHN0YW5kYXJkIG91dHB1dC48XC9wPlxyXG4iLCJoaW50IjoiIiwib3JpZ2luYWwiOiIxIiwicHJvYmxlbV9sYW5nX2NvZGUiOiJcdWM2MDFcdWM1YjQifV0=

출처

ACM-ICPC > Regionals > Latin America > South America Regional Contests 2008 F번

  • 문제를 번역한 사람: baekjoon
  • 문제의 오타를 찾은 사람: kipa00