시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 890 403 329 43.634%

문제

페르마의 마지막 정리는, 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)

노트

페르마의 마지막 정리는 1995년에 앤드루 와일스에 의해 증명되었다.

W3sicHJvYmxlbV9pZCI6IjQ2OTAiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM2NDRcdWM4MDQgXHVjMTM4XHVjODFjXHVhY2YxIiwiZGVzY3JpcHRpb24iOiI8cD5cdWQzOThcdWI5NzRcdWI5YzhcdWM3NTggXHViOWM4XHVjOWMwXHViOWM5IFx1YzgxNVx1YjlhY1x1YjI5NCwgYSwgYiwgY1x1YWMwMCAwXHVjNzc0IFx1YzU0NFx1YjJjYyBcdWM4MTVcdWMyMThcdWM3NzRcdWFjZTAsIG5cdWM3NzQgMlx1YmNmNFx1YjJlNCBcdWQwNzAgXHVjNzkwXHVjNWYwXHVjMjE4IFx1Yzc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Ghlc2UgY2FzZXMsIHRoZSB0cmlwbGVzIHdpdGggdGhlIHNtYWxsZXIgYiB2YWx1ZXMgc2hvdWxkIGJlIGxpc3RlZCBmaXJzdC48XC9wPlxyXG5cclxuPHA+Tm90ZTogVGhlIHByb2dyYW1tZXIgd2lsbCBuZWVkIHRvIGJlIGNvbmNlcm5lZCB3aXRoIGFuIGVmZmljaWVudCBpbXBsZW1lbnRhdGlvbi4gVGhlIG9mZmljaWFsIHRpbWUgbGltaXQgZm9yIHRoaXMgcHJvYmxlbSBpcyAyIG1pbnV0ZXMsIGFuZCBpdCBpcyBpbmRlZWQgcG9zc2libGUgdG8gd3JpdGUgYSBzb2x1dGlvbiB0byB0aGlzIHByb2JsZW0gd2hpY2ggZXhlY3V0ZXMgaW4gdW5kZXIgMiBtaW51dGVzIG9uIGEgMzMgTUh6IDgwMzg2IG1hY2hpbmUuIER1ZSB0byB0aGUgZGlzdHJpYnV0ZWQgbmF0dXJlIG9mIHRoZSBjb250ZXN0IGluIHRoaXMgcmVnaW9uLCBqdWRnZXMgaGF2ZSBiZWVuIGluc3RydWN0ZWQgdG8gbWFrZSB0aGUgb2ZmaWNpYWwgdGltZSBsaW1pdCBhdCB0aGVpciBzaXRlIHRoZSBncmVhdGVyIG9mIDIgbWludXRlcyBvciB0d2ljZSB0aGUgdGltZSB0YWtlbiBieSB0aGUganVkZ2UmIzM5O3Mgc29sdXRpb24gb24gdGhlIG1hY2hpbmUgYmVpbmcgdXNlZCB0byBqdWRnZSB0aGlzIHByb2JsZW0uPFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsInByb2JsZW1fbGFuZ19jb2RlIjoiXHVjNjAxXHVjNWI0In1d

출처

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

  • 문제를 번역한 사람: baekjoon
  • 문제의 오타를 찾은 사람: doju
  • 어색한 표현을 찾은 사람: mwy3055
  • 내용을 추가한 사람: runnie0427

채점

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