시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 675 306 258 45.343%

문제

페르마의 마지막 정리에 의하면, 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)
W3sicHJvYmxlbV9pZCI6IjQ2OTAiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM2NDRcdWM4MDQgXHVjMTM4XHVjODFjXHVhY2YxIiwiZGVzY3JpcHRpb24iOiI8cD5cdWQzOThcdWI5NzRcdWI5YzhcdWM3NTggXHViOWM4XHVjOWMwXHViOWM5IFx1YzgxNVx1YjlhY1x1YzVkMCBcdWM3NThcdWQ1NThcdWJhNzQsIGEsIGIsIGNcdWFjMDAgMFx1Yzc3NCBcdWM1NDRcdWIyY2MgXHVjODE1XHVjMjE4XHVjNzc0XHVhY2UwLCBuXHVjNzc0IDJcdWJjZjRcdWIyZTQgXHVkMDcwIFx1Yzc5MFx1YzVmMFx1YzIxOCBcdWM3N2MgXHViNTRj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RlcywgYW5kIGl0IGlzIGluZGVlZCBwb3NzaWJsZSB0byB3cml0ZSBhIHNvbHV0aW9uIHRvIHRoaXMgcHJvYmxlbSB3aGljaCBleGVjdXRlcyBpbiB1bmRlciAyIG1pbnV0ZXMgb24gYSAzMyBNSHogODAzODYgbWFjaGluZS4gRHVlIHRvIHRoZSBkaXN0cmlidXRlZCBuYXR1cmUgb2YgdGhlIGNvbnRlc3QgaW4gdGhpcyByZWdpb24sIGp1ZGdlcyBoYXZlIGJlZW4gaW5zdHJ1Y3RlZCB0byBtYWtlIHRoZSBvZmZpY2lhbCB0aW1lIGxpbWl0IGF0IHRoZWlyIHNpdGUgdGhlIGdyZWF0ZXIgb2YgMiBtaW51dGVzIG9yIHR3aWNlIHRoZSB0aW1lIHRha2VuIGJ5IHRoZSBqdWRnZSYjMzk7cyBzb2x1dGlvbiBvbiB0aGUgbWFjaGluZSBiZWluZyB1c2VkIHRvIGp1ZGdlIHRoaXMgcHJvYmxlbS48XC9wPlxyXG4iLCJoaW50IjoiIiwib3JpZ2luYWwiOiIxIiwicHJvYmxlbV9sYW5nX2NvZGUiOiJcdWM2MDFcdWM1YjQifV0=

출처

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

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

채점

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