-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem39.cpp
More file actions
40 lines (39 loc) · 843 Bytes
/
Problem39.cpp
File metadata and controls
40 lines (39 loc) · 843 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
//840
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
// ios_base::sync_with_stdio(false);
// cin.tie(NULL);
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
ll p = 3;
ll s = 0;
for(int i=3;i<=1000;i++)
{
cout<<i<<"\n";
ll cnt = 0;
for(int a = 1;a<i/2;a++)
{
for(int b = a;b<i/2;b++)
{
int c = i-a-b;
if(c<0)
continue;
if(a*a + b*b == c*c)
{
cnt++;
}
}
}
if(cnt>s)
{
s = cnt;
p = i;
}
}
cout<<"\n"<<s<<" "<<p<<"\n";
}