Submission #63835195
Source Code Expand
Copy
#include<iostream>#include<cmath>using namespace std;int main(){long long n;cout<<"请输入一个正整数 n (n <= 10^18): ";cin>>n;for(long long d=1;d*d<=n;d++){if(n%d!=0)continue;long long q=n/d;long long dis=9*d*d-12*(d*d-q);if(dis<0)continue;long long sdis=sqrt(dis);if(sdis*sdis!=dis)continue;long long y=(-3*d+sdis)/6;if(y>0&&3*y*y+3*d*y+d*d==q){long long x=y+d;cout<<"存在满足条件的正整数对 (x, y): ("<<x<<", "<<y<<")"<<endl;return 0;}}
#include<iostream> #include<cmath> using namespace std; int main(){ long long n; cout<<"请输入一个正整数 n (n <= 10^18): "; cin>>n; for(long long d=1;d*d<=n;d++){ if(n%d!=0)continue; long long q=n/d; long long dis=9*d*d-12*(d*d-q); if(dis<0)continue; long long sdis=sqrt(dis); if(sdis*sdis!=dis)continue; long long y=(-3*d+sdis)/6; if(y>0&&3*y*y+3*d*y+d*d==q){ long long x=y+d; cout<<"存在满足条件的正整数对 (x, y): ("<<x<<", "<<y<<")"<<endl; return 0; } } cout<<"不存在满足条件的正整数对 (x, y)"<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Cubes |
User | sjc2 |
Language | C++ 17 (Clang 16.0.6) |
Score | 0 |
Code Size | 705 Byte |
Status | WA |
Exec Time | 2210 ms |
Memory | 3620 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 425 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | WA | 1 ms | 3536 KB |
00_sample_01.txt | WA | 1 ms | 3512 KB |
00_sample_02.txt | WA | 2 ms | 3492 KB |
01_test_00.txt | WA | 1480 ms | 3544 KB |
01_test_01.txt | TLE | 2207 ms | 3344 KB |
01_test_02.txt | WA | 3 ms | 3552 KB |
01_test_03.txt | WA | 4 ms | 3512 KB |
01_test_04.txt | WA | 3 ms | 3512 KB |
01_test_05.txt | WA | 1 ms | 3544 KB |
01_test_06.txt | WA | 2 ms | 3512 KB |
01_test_07.txt | WA | 1 ms | 3484 KB |
01_test_08.txt | WA | 3 ms | 3620 KB |
01_test_09.txt | WA | 1953 ms | 3540 KB |
01_test_10.txt | TLE | 2207 ms | 3332 KB |
01_test_11.txt | WA | 2 ms | 3516 KB |
01_test_12.txt | WA | 3 ms | 3476 KB |
01_test_13.txt | WA | 2 ms | 3612 KB |
01_test_14.txt | WA | 2 ms | 3476 KB |
01_test_15.txt | TLE | 2207 ms | 3284 KB |
01_test_16.txt | WA | 1 ms | 3508 KB |
01_test_17.txt | WA | 1 ms | 3420 KB |
01_test_18.txt | WA | 1 ms | 3540 KB |
01_test_19.txt | WA | 1 ms | 3480 KB |
01_test_20.txt | TLE | 2210 ms | 3336 KB |
01_test_21.txt | TLE | 2207 ms | 3348 KB |
01_test_22.txt | TLE | 2207 ms | 3232 KB |
01_test_23.txt | TLE | 2207 ms | 3288 KB |
01_test_24.txt | WA | 1 ms | 3480 KB |
01_test_25.txt | WA | 1 ms | 3516 KB |
01_test_26.txt | WA | 1 ms | 3612 KB |
01_test_27.txt | WA | 1 ms | 3540 KB |
01_test_28.txt | WA | 1 ms | 3480 KB |
01_test_29.txt | WA | 1 ms | 3616 KB |
01_test_30.txt | WA | 1 ms | 3476 KB |
01_test_31.txt | WA | 2 ms | 3476 KB |