시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 958 738 669 79.548%

문제

리처드 필립스 파인만은 노벨 물리학상을 수상한 미국의 물리학자이다. 그는 이론물리학을 연구했고, 양자 컴퓨팅 분야를 개척했다. "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
W3sicHJvYmxlbV9pZCI6IjU3MjQiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWQzMGNcdWM3NzhcdWI5Y2MiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YjlhY1x1Y2M5OFx1YjRkYyBcdWQ1NDRcdWI5YmRcdWMyYTQgXHVkMzBjXHVjNzc4XHViOWNjXHVjNzQwIFx1YjE3OFx1YmNhOCBcdWJiM2NcdWI5YWNcdWQ1NTlcdWMwYzFcdWM3NDQgXHVjMjE4XHVjMGMxXHVkNTVjIFx1YmJmOFx1YWQ2ZFx1Yzc1OCBcdWJiM2NcdWI5YWN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ZSBpbnB1dCBjb250YWlucyBzZXZlcmFsIHRlc3QgY2FzZXMuIEVhY2ggdGVzdCBjYXNlIGlzIGNvbXBvc2VkIG9mIGEgc2luZ2xlIGxpbmUsIGNvbnRhaW5pbmcgb25seSBvbmUgaW50ZWdlciBOLCByZXByZXNlbnRpbmcgdGhlIG51bWJlciBvZiBzcXVhcmVzIGluIGVhY2ggc2lkZSBvZiB0aGUgZ3JpZCAoMSAmbGU7IE4gJmxlOyAxMDApLjxcL3A+XHJcblxyXG48cD5UaGUgZW5kIG9mIGlucHV0IGlzIGluZGljYXRlZCBieSBhIGxpbmUgY29udGFpbmluZyBvbmx5IG9uZSB6ZXJvLjxcL3A+XHJcblxyXG48cD5UaGUgaW5wdXQgbXVzdCBiZSByZWFkIGZyb20gc3RhbmRhcmQgaW5wdXQuPFwvcD5cclxuIiwib3V0cHV0IjoiPHA+Rm9yIGVhY2ggdGVzdCBjYXNlIGluIHRoZSBpbnB1dCwgeW91ciBwcm9ncmFtIG11c3QgcHJpbnQgYSBzaW5nbGUgbGluZSwgY29udGFpbmluZyB0aGUgbnVtYmVyIG9mIGRpZmZlcmVudCBzcXVhcmVzIGZvciB0aGUgY29ycmVzcG9uZGluZyBpbnB1dC48XC9wPlxyXG5cclxuPHA+VGhlIG91dHB1dCBtdXN0IGJlIHdyaXR0ZW4gdG8gc3RhbmRhcmQgb3V0cHV0LjxcL3A+XHJcbiIsImhpbnQiOiIiLCJvcmlnaW5hbCI6IjEiLCJwcm9ibGVtX2xhbmdfY29kZSI6Ilx1YzYwMVx1YzViNCJ9XQ==

출처

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

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