-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path9.cpp
More file actions
51 lines (33 loc) · 626 Bytes
/
Copy path9.cpp
File metadata and controls
51 lines (33 loc) · 626 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include<iostream>
using namespace std;
int main()
{
int t,n,i,ma,temp,a,b,c;
cin>>t;
while(t--)
{
cin>>n;
ma=0;
for(a=1;a<=(n-3)/3;a++)
{
b=(n-a*2)/2;
c=n-a-b;
for(b;b<c;b)
{
temp=0;
if(a*a+b*b==c*c)
{
temp=a*b*c;
}
b+=1;
c=n-a-b;
if(temp>ma)
ma=temp;
}
}
if(ma==0)
ma=-1;
cout<<ma<<endl;
}
return 0;
}