Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
135140 徐英杰 完美立方 C++ Time Limit Exceeded 1000 MS 280 KB 628 2025-11-02 16:46:51

Tests(2/10):


Code:

#include <iostream> #include<cmath> using namespace std; void OJ1491(int n) { for (int a = 2;a <= n;a++) { for (int b = 2;b <= n;b++) { for (int c = 2;c <= n;c++) { for (int d = 2;d<= n;d++) { bool tiaojian=( pow(a,3) == pow(b,3) + pow(c,3) + pow(d,3) ) && (b <= c && c<=d); if (tiaojian) { cout<<"Cube = "<<a<<", Triple = ("<<b<<","<<c<<","<<d<<")"<<endl; } } } } } } int main() { int N; cin>>N; OJ1491(N); return 0; }