Problem: OjLight Problem 1053 - Higher Math
Solution:
This is the simplest problem I ever had, just implement the given formulas! However, it does take me some time to write.
Code:
Solution:
This is the simplest problem I ever had, just implement the given formulas! However, it does take me some time to write.
Code:
#include <bits/stdc++.h>
using namespace std;
main(){
long long n,a,b,c,f,g;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a>>b>>c;
if(a>b && a>c)
{
f= a*a;
g=(b*b)+(c*c);
}
else if(b>a&&b>c){
f= (b*b);
g= a*a+c*c;
}
else if(c>a&& c>b){
f=c*c;
g=a*a+b*b;
}
(f==g?cout<<"Case "<<i<<":"<<" yes"<<endl:cout<<"Case "<<i<<":"<<" no"<<endl);
}
return 0;
}
No comments:
Post a Comment