Last active
August 10, 2018 08:06
-
-
Save myguaguagua/113c672c0144a9fdd79429de9df348fd to your computer and use it in GitHub Desktop.
学妹的思考题
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() { | |
int T; | |
cin >> T; | |
while (T--) { | |
int n; | |
cin >> n; | |
int max_xyz = -1; | |
for (int x = 1; x < n; x++) { | |
if (n % x == 0) { | |
for (int y = x; y < n; y++) { | |
if (n % y == 0) { | |
int z = n - x - y; | |
if (z == 0) { | |
continue; | |
} | |
if (n % z == 0) { | |
int xyz = x * y * z; | |
if (xyz > max_xyz) { | |
max_xyz = xyz; | |
} | |
} | |
} | |
} | |
} | |
} | |
cout << max_xyz << endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment