Common Raccoon vs Monster

B - Common Raccoon vs Monster

  1. 链接

    B - Common Raccoon vs Monster

  2. 题意

    判定数组和与h的关系

  3. 代码实现

    #include<bits/stdc++.h> 
    using namespace std;
    typedef long long ll;
    const int maxn = 1e5+10;
    int a[maxn];
    int main(void){
     int h,n;
     cin >> h >> n;
     ll sum = 0;
     for(int i = 0; i < n; i++){
         cin >> a[i];
         sum += a[i];
     }
     if(sum>=h)
         cout<<"Yes"<<endl;
     else
         cout<<"No"<<endl;
     return 0;
    
    }
    

猜你喜欢

转载自www.cnblogs.com/AC-AC/p/12235905.html