首页 > 代码库 > CF大神的模板我改版的
CF大神的模板我改版的
1 #include<iostream> 2 #include<cmath> 3 #include<cstdio> 4 #include<sstream> 5 #include<cstdlib> 6 #include<string> 7 #include<string.h> 8 #include<cstring> 9 #include<algorithm> 10 #include<vector> 11 #include<map> 12 #include<set> 13 #include<stack> 14 #include<list> 15 #include<queue> 16 #include<ctime> 17 #include<bitset> 18 #include<cmath> 19 20 #include <iomanip> 21 22 #define eps 1e-6 23 #define INF 0x3f3f3f3f 24 #define PI acos(-1.0) 25 #define ll __int64 26 #define LL long long 27 28 #define lson l,m,(rt<<1) 29 #define rson m+1,r,(rt<<1)|1 30 #define M 1000000007 31 32 //#pragma comment(linker,"/STACK:102400000,102400000") 33 34 //#define LOCAL_DEFINE 35 36 using namespace std; 37 38 39 40 int MAIN() 41 { 42 int s,n,k,i,sum,max; 43 while(cin>>n>>s) 44 { 45 sum=0; 46 max=-1; 47 for(i=0;i<n;i++) 48 { 49 cin>>k; 50 if(k>max) max=k; 51 sum+=k; 52 } 53 sum-=max; 54 if(sum<=s) 55 cout<<"YES"<<endl; 56 else cout<<"NO"<<endl; 57 } 58 return 0; 59 } 60 61 int main() { 62 #ifdef LOCAL_DEFINE 63 freopen("input.txt", "rt", stdin); 64 freopen("output.txt", "wt", stdout); 65 #endif 66 ios :: sync_with_stdio(false); 67 cout << fixed << setprecision(16); 68 69 #ifdef LOCAL_DEFINE 70 cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; 71 #endif 72 return MAIN(); 73 }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。