Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- using namespace std;
- bool isTriangle(double, double, double);
- bool isRectangular(double a, double b, double c);
- const double e = 0.0001;
- int main(const int argc, char ** argv)
- {
- double a, b, c;
- cin >> a >> b >> c;
- if (isTriangle(a, b, c)) {
- if (isRectangular(a, b, c) || isRectangular(a, c, b) || isRectangular(b, a, c) || isRectangular(b, c, a) || isRectangular(c, a, b) || isRectangular(c, b, a)) {
- cout << "YES";
- }
- }
- else cout << "NO";
- return 0;
- }
- bool isTriangle(double a, double b, double c) {
- if (a + b > c && b + c > a && a + c > b) return true;
- else return false;
- }
- bool isRectangular(double a, double b, double c) {
- if (e > abs(b * b + c * c - a * a) || e > abs(b * b + a * a - c * c) || e > abs(a * a + c * c - b * b)) { // равносильно теореме Пифагора, но с погрешностью e
- return true;
- }
- else return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement