Skip to content

Commit 7eb6a05

Browse files
committed
learned math
1 parent 876c781 commit 7eb6a05

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

atCoder362/B_Right_Triangle.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
////https://atcoder.jp/contests/abc362/tasks/abc362_b
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
typedef long long ll;
5+
const int mod = 1e9 + 7;
6+
const int N = 1e5 + 5;
7+
8+
void solve(){
9+
//for A
10+
int xa,ya;cin>>xa>>ya;
11+
//for B
12+
int xb,yb;cin>>xb>>yb;
13+
//for C
14+
int xc,yc;cin>>xc>>yc;
15+
16+
//for AB // formula for distance between two points AB^2=(xb-xa)^2+(yb-ya)^2
17+
int AB_2=(xb-xa)*(xb-xa)+(yb-ya)*(yb-ya);
18+
int BC_2=(xc-xb)*(xc-xb)+(yc-yb)*(yc-yb);
19+
int AC_2=(xc-xa)*(xc-xa)+(yc-ya)*(yc-ya);
20+
21+
if(AB_2+BC_2==AC_2 || AB_2+AC_2==BC_2 || AC_2+BC_2==AB_2){
22+
cout<<"Yes"<<endl;
23+
}
24+
else{
25+
cout<<"No"<<endl;
26+
}
27+
}
28+
29+
int main() {
30+
ios_base::sync_with_stdio(0);
31+
cin.tie(0);
32+
solve();
33+
}

0 commit comments

Comments
 (0)