CF 1279A-New Year Garland

Topic: https: //vjudge.net/problem/CodeForces-1279A

Analysis: number of lamps sorting three colors, for the largest number of lamps, the lamps can be inserted with the other two if all intervals satisfied; otherwise there must be connected to two lamps. Two other number of lamps arranged as a, b, most light is c, the interval c-1, when a + b> = c-1, is satisfied; otherwise satisfied.

 1 #include <iostream>
 2 #include <algorithm>
 3 using namespace std;
 4 int main(void){
 5     int t;
 6     cin>>t;
 7     while(t--){
 8         int a[3]={0};
 9         cin>>a[0]>>a[1]>>a[2];
10         sort(a,a+3);
11         if(a[0]+a[1]>=a[2]-1)cout<<"Yes"<<endl;
12         else cout<<"No"<<endl;
13     }
14     return 0;
15 }

 

Guess you like

Origin www.cnblogs.com/yanying7/p/12336675.html