문제 링크입니다: https://www.acmicpc.net/problem/4690
4690번: 완전 세제곱
페르마의 마지막 정리는, a, b, c가 0이 아닌 정수이고, n이 2보다 큰 자연수 일 때, an = bn + cn을 만족하는 자연수 a, b, c가 존재하지 않는다는 정리이다. 이 정리는 아직 증명되지 않았다. 하지만, 완
www.acmicpc.net
간단한 구현 문제였습니다.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
for (int a = 1; a <= 100; a++) | |
{ | |
for (int b = 2; b <= a; b++) | |
{ | |
for (int c = b; c <= a; c++) | |
{ | |
for (int d = c; d <= a; d++) | |
{ | |
if (a * a * a == b * b * b + c * c * c + d * d * d) | |
{ | |
cout << "Cube = " << a << ", Triple = (" << b << "," << c << "," << d << ")\n"; | |
} | |
} | |
} | |
} | |
} | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 4758번 Filling Out the Team (0) | 2021.05.16 |
---|---|
백준 4714번 Lunacy (0) | 2021.05.16 |
백준 4655번 Hangover (0) | 2021.05.16 |
백준 4635번 Speed Limit (0) | 2021.05.16 |
백준 4623번 Copier Reduction (0) | 2021.05.16 |