시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 792 351 297 43.805%

문제

페르마의 마지막 정리에 의하면, a, b, c가 0이 아닌 정수이고, n이 2보다 큰 자연수 일 때, an = bn + cn을 만족하는 자연수 a, b, c가 존재하지 않는다는 정리이다. 이 정리는 아직 증명되지 않았다.

하지만, 완전 세제곱 방정식 a3 = b3 + c3 + d3을 만족하는 1보다 큰 자연수를 찾는 것은 어렵지 않다. (123 = 63 + 83 + 103)

이러한 완전 세제곱 방정식과 a ≤ 100을 만족하는 {a, b, c, d}쌍을 모두 찾는 프로그램을 작성하시오.

입력

이 문제는 입력이 없다.

출력

a값이 증가하는 순서대로 아래 출력 형식과 같이 출력한다. b, c, d도 증가하는 순서로 이루어져야 한다. a값에 해당하는 b, c, d쌍이 여러 개 존재할 수 있다. 이때는 b 값이 작은 것부터 먼저 출력한다.

아래 출력 예제는 일부분만 나와있다.

예제 입력 1


						

예제 출력 1

Cube = 6, Triple = (3,4,5)
Cube = 12, Triple = (6,8,10)
Cube = 18, Triple = (2,12,16)
Cube = 18, Triple = (9,12,15)
Cube = 19, Triple = (3,10,18)
Cube = 20, Triple = (7,14,17)
Cube = 24, Triple = (12,16,20)
W3sicHJvYmxlbV9pZCI6IjQ2OTAiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM2NDRcdWM4MDQgXHVjMTM4XHVjODFjXHVhY2YxIiwiZGVzY3JpcHRpb24iOiI8cD5cdWQzOThcdWI5NzRcdWI5YzhcdWM3NTggXHViOWM4XHVjOWMwXHViOWM5IFx1YzgxNVx1YjlhY1x1YzVkMCBcdWM3NThcdWQ1NThcdWJhNzQsIGEsIGIsIGNcdWFjMDAgMFx1Yzc3NCBcdWM1NDRcdWIyY2MgXHVjODE1XHVjMjE4XHVjNzc0XHVhY2UwLCBuXHVjNzc0IDJcdWJjZjRcdWIyZTQgXHVkMDcwIFx1Yzc5MFx1YzVmMFx1YzIxOCBcdWM3N2MgXHViNTRjL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b2JsZW0gaXMgMiBtaW51dGVzLCBhbmQgaXQgaXMgaW5kZWVkIHBvc3NpYmxlIHRvIHdyaXRlIGEgc29sdXRpb24gdG8gdGhpcyBwcm9ibGVtIHdoaWNoIGV4ZWN1dGVzIGluIHVuZGVyIDIgbWludXRlcyBvbiBhIDMzIE1IeiA4MDM4NiBtYWNoaW5lLiBEdWUgdG8gdGhlIGRpc3RyaWJ1dGVkIG5hdHVyZSBvZiB0aGUgY29udGVzdCBpbiB0aGlzIHJlZ2lvbiwganVkZ2VzIGhhdmUgYmVlbiBpbnN0cnVjdGVkIHRvIG1ha2UgdGhlIG9mZmljaWFsIHRpbWUgbGltaXQgYXQgdGhlaXIgc2l0ZSB0aGUgZ3JlYXRlciBvZiAyIG1pbnV0ZXMgb3IgdHdpY2UgdGhlIHRpbWUgdGFrZW4gYnkgdGhlIGp1ZGdlJiMzOTtzIHNvbHV0aW9uIG9uIHRoZSBtYWNoaW5lIGJlaW5nIHVzZWQgdG8ganVkZ2UgdGhpcyBwcm9ibGVtLjxcL3A+XHJcbiIsImhpbnQiOiIiLCJvcmlnaW5hbCI6IjEiLCJwcm9ibGVtX2xhbmdfY29kZSI6Ilx1YzYwMVx1YzViNCJ9XQ==

출처

ACM-ICPC > Regionals > North America > Mid-Central Regional > 1995 Mid-Central Regional Programming Contest 2번

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

채점

  • 예제는 채점하지 않는다.