-
Notifications
You must be signed in to change notification settings - Fork 0
/
h014.cpp
61 lines (54 loc) · 804 Bytes
/
h014.cpp
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
51
52
53
54
55
56
57
58
59
60
61
#include<iostream>
#include<fstream>
#define maximum 99
class straight_graph
{
private:
int dot1, dot2, dot3;
public:
straight_graph(std::ifstream& input);
void calc();
};
void main()
{
std::ifstream in_file;
in_file.open("input.txt");
int cases;
in_file>>cases;
for(int i=0; i<cases; i++)
{
straight_graph lf(in_file);
lf.calc();
}
}
straight_graph :: straight_graph(std::ifstream& input)
{
input>>dot1;
input>>dot2;
input>>dot3;
}
void straight_graph::calc()
{
int triangle;
if(dot3>=dot1+dot2)
{
triangle = 0;
}
else if(dot3==dot2 && dot2==dot1)
{
triangle = 1;
}
else if(dot3*dot3==dot2*dot2 + dot1*dot1)
{
triangle = 2;
}
else if(dot2==dot1 || dot2 == dot3 || dot1==dot3)
{
triangle = 3;
}
else
{
triangle = 4;
}
std ::cout<<triangle<<std::endl;
}