Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- using namespace std;
- bool invalid(double a, double b, double c){
- if(a+b > c && a+c > b && b+c > a)return false;
- return true;
- }
- int main(){
- int n;
- cin>>n;
- double ar[n];
- for(int i=0;i<n;i++)cin>>ar[i];
- int ac=0,ri=0,ob=0;
- double a,b,c,h;
- for(int i=0;i<n;i++){
- for(int j=i+1;j<n;j++){
- for(int k=j+1;k<n;k++){
- a=ar[i];
- b=ar[j];
- c=ar[k];
- if(invalid(a,b,c))continue;
- if(ar[i] >= ar[j] && ar[i] >= ar[k]){
- c=ar[i];
- a=ar[j];
- b=ar[k];
- }else if(ar[j] >= ar[i] && ar[j] >= ar[k]){
- c=ar[j];
- a=ar[i];
- b=ar[k];
- }
- h= sqrt(a*a + b*b);
- //cout<<h<<" "<<c<<endl;
- if (h==c)ri++;
- else if(h < c)ob++;
- else ac++;
- }
- }
- }
- cout<<ac<<" "<<ri<<" "<<ob<<endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment