前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >P4745 B’s problem(b)

P4745 B’s problem(b)

作者头像
attack
发布2018-04-12 15:24:30
5350
发布2018-04-12 15:24:30
举报
文章被收录于专栏:数据结构与算法
代码语言:javascript
复制
 1 #include<iostream>
 2 #include<algorithm>
 3 using namespace std;
 4 int a[10001];
 5 int tot;//食堂阿姨手里的钱 
 6 int ans;//
 7 int main()
 8 {
 9     int n;
10     cin>>n;
11     for(int i=1;i<=n;i++)
12     {
13         cin>>a[i];
14     }
15     sort(a+1,a+n+1);
16     for(int i=1;i<=n;i++)
17     {
18         if(a[i]==25)
19         {
20             tot=tot+25;
21         }
22         else if(a[i]==50)
23         {
24             tot=tot+25;
25         }
26         else if(a[i]==100)
27         {
28             tot=tot-75;
29         }
30     }
31     if(tot>=0)
32     cout<<"YES";
33     else 
34     cout<<"NO";
35     return 0;
36 }
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017-03-22 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档