当前位置: 首页 > news >正文

AtCoder Weekday Contest 0010 Beta题解(AWC 0010 Beta A-E)

A - Distributing Requests to Servers

【题目来源】

AtCoder:A - Distributing Requests to Servers

【题目描述】

Takahashi is a web service operations manager. His system has \(N\) servers, and a large-scale campaign spanning \(M\) days starts tomorrow.
高桥是一名网络服务运维经理。他的系统有 \(N\) 台服务器,一场持续 \(M\) 天的大规模活动将于明天开始。

During the campaign period, exactly \(1\) heavy processing request occurs each day. For each of the \(M\) days, Takahashi must assign that request to exactly \(1\) of the \(N\) servers. The same server may be chosen on multiple days.
在活动期间,每天恰好发生 \(1\) 个重处理请求。对于这 \(M\) 天中的每一天,高桥必须将该请求分配给 \(N\) 台服务器中的恰好 \(1\) 台。同一台服务器可在多天被选择。

Each server \(i\) (\(1 \leq i \leq N\)) has a "processing capacity" \(A_i\). If the total number of requests assigned to server \(i\) throughout the entire campaign period is at most \(A_i\), that server operates normally. On the other hand, if more than \(A_i\) requests are assigned to it, that server will go down. Takahashi must not let any server go down.
每台服务器 \(i\)\(1 ≤ i ≤ N\))具有一个"处理容量" \(A_i\)。如果分配给服务器 \(i\) 的请求总数在整个活动期间不超过 \(A_i\),则该服务器正常运行。反之,如果分配给它的请求超过 \(A_i\),则该服务器将宕机。高桥绝不能允许任何服务器宕机。

Can Takahashi choose request assignments wisely enough to get through the \(M\)-day campaign without any server going down?
高桥能否明智地选择请求分配方案,以便在 \(M\) 天的活动期间不让任何服务器宕机?

If there exists an assignment that allows all \(M\) days to be completed without any server going down, output Yes; otherwise, output No.
如果存在一种分配方案使得所有 \(M\) 天都能完成且不让任何服务器宕机,则输出 Yes;否则,输出 No

【输入】

\(N\) \(M\)
\(A_1\) \(A_2\) \(\ldots\) \(A_N\)

  • The first line contains an integer \(N\) representing the number of servers and an integer \(M\) representing the number of campaign days, separated by a space.
  • The second line contains \(N\) integers \(A_1, A_2, \ldots, A_N\) representing the processing capacity of each server, separated by spaces.

【输出】

If there exists an assignment that allows all \(M\) days of the campaign to be completed without any server going down, output Yes; otherwise, output No on a single line.

【输入样例】

3 10
3 4 2

【输出样例】

No

【解题思路】

image

【代码详解】

#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, m, sum;  // n: 数字个数,m: 目标值,sum: 数字总和signed main()
{cin >> n >> m;  // 读入数字个数n和目标值mfor (int i = 1; i <= n; i++)  // 读取n个数字{int x; cin >> x;  // 读入第i个数字sum += x;  // 累加到总和}if (sum >= m)  // 如果总和大于等于目标值{cout << "Yes";}else{cout << "No";}return 0;
}

【运行结果】

3 10
3 4 2
No
http://www.jsqmd.com/news/435449/

相关文章:

  • 2026年口碑好的全自动缓冲纸袋机制造厂推荐 售后有保障 - myqiye
  • 改变文档修改时间的 6 种实用技巧,无需额外工具
  • 文档的修改日期能改吗?快速改文档修改日期技巧
  • 聊聊板材存放架靠谱厂家,哪家性价比高且口碑好 - 工业设备
  • 振动流化床干燥机定制化解决方案:国内三家技术型厂家的核心竞争力分析 - 品牌推荐大师
  • SageMaker算法如何推动机器学习民主化
  • H2O-3反序列化漏洞分析(CVE-2025-6507CVE-2025-6544)
  • 受认可的美国海外仓靠谱不,收费标准是多少钱? - mypinpai
  • 真心不骗你! 自考必备的降AI率软件 千笔·专业降AIGC智能体 VS 学术猹
  • 日通机械基本信息有哪些,好用吗,在江苏地区口碑怎样? - 工业推荐榜
  • 2026中国的染发膏有比外国好的品牌吗?国货创新实力解析 - 品牌排行榜
  • ERROR 1820 (HY000): You must reset your password using ALTER USER statement‌
  • 聊聊2026年好用的劳动纠纷律师,证据精通文书起草维权有保障 - 工业品网
  • git批量删除本地多余分支
  • 深圳选到俄罗斯物流方案,易斯拉国际物流靠谱不? - 工业品牌热点
  • 如何查看文档真实修改时间?绕过表面显示的方法
  • 性价比高的劳动纠纷律师推荐,能处理索赔案件的有吗? - myqiye
  • 京东e卡回收热门平台流程复盘 - 京回收小程序
  • 第二届航空航天工程与材料技术国际会议(AEMT 2026)
  • 2026年江苏全自动缓冲纸袋机十大厂家排名,哪家值得选 - mypinpai
  • 2026三边封拉链袋评测:优质厂商推荐指南,三边封拉链袋/纹路袋/自立拉链袋/中封袋/包装袋,三边封拉链袋优质厂家选哪家 - 品牌推荐师
  • 2026年剖析江苏全自动多功能覆膜机,靠谱的供应商怎么选择 - 工业设备
  • 狗狗掉毛怎么改善,杭州鼎伴畅敏33好用吗 - 工业品牌热点
  • 总结秦皇岛不错的巨量推广公司,哪家性价比更高? - 工业推荐榜
  • KingbaseES PLSQL异常处理深度解析:机制、实践与优化
  • 我用Cursor开发了3个月,整理出这套提效4倍的工作流
  • 讲讲东宇电气好不好,设备与服务是否值得选择 - 工业品网
  • 2026江苏日通机械客户评价、技术创新与广告宣传效果,哪个更值得选 - myqiye
  • 参考文献崩了?AI论文工具 千笔写作工具 VS 文途AI,MBA专属神器!
  • 2026年气泡纸压花机选购指南,生产厂哪家更值得选揭秘 - mypinpai