02,如果没有三角形,那么数列是斐波拉契数列级别增长,所以个数<50;

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
const int maxn=5000010;
int a[maxn];
int main(){
    //freopen("input.txt","r",stdin);
    int N;
    while(~scanf("%d",&N)){
        rep(i,1,N) scanf("%d", &a[i]);
        bool F=0;
        if(N<100){
           sort(a+1,a+N+1);
           rep(i,1,N-2){
               if(a[i]+a[i+1]>a[i+2]){ F=1; break; }
           }
        }
        else F=true;
        puts(F?"YES":"NO");
    }
    return 0;
}
View Code<

相关文章:

  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
猜你喜欢
  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
  • 2021-06-13
  • 2021-11-16
  • 2021-07-08
  • 2021-04-29
相关资源
相似解决方案