You are viewing a single comment's thread. Return to all comments →
Here is one possible solution!!
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n,count=0; cin>>n; int a[n]; for(int i=0;i<n;i++){ cin>>a[i]; } sort(a,a+n); for(int j=n-1;j>0;j--){ if((a[j-2]+a[j-1])>a[j]){ cout<<a[j-2]<<" "<<a[j-1]<<" "<<a[j]<<endl; count++; break; } } if(count==0){ cout<<"-1"<<endl; } return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Maximum Perimeter Triangle
You are viewing a single comment's thread. Return to all comments →
Here is one possible solution!!
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */
}