Codeforces Round #243 (Div. 2) A. Sereja and Mugs

时间:2014-04-29 16:42:39   收藏:0   阅读:415
bubuko.com,布布扣
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

int main(){
    int n,s;
    cin >> n >> s;
    vector<int> a(n);
    for(int i = 0 ; i < n ; ++ i) cin >> a[i];
    sort(a.begin(),a.end());
    int sum = accumulate(a.begin(),a.end()-1,0);
    if(sum > s) cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
    return 0;
}
bubuko.com,布布扣

 

Codeforces Round #243 (Div. 2) A. Sereja and Mugs,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!