ZOJ 3767-Elevator
2016-03-02 14:06
260 查看
B -
Elevator
Crawling in process...
Crawling failed
Time Limit:2000MS
Memory Limit:65536KB 64bit IO Format:%lld & %llu
Submit
Status
Practice
ZOJ 3767
Appoint description:
System Crawler (2016-03-02)
Description
How time flies! The graduation of this year is around the corner. N members of ZJU ACM/ICPC Team decided to hold a party in a restaurant. The restaurant is located in a skyscraper so they need to take an elevator to reach there.
The elevator's maximum load is M kilograms. The weight of the i-th team member is
Ai kilograms. If the total weight of people in the elevator exceeds the maximum load of the elevator, the elevator will raise the alarm and will not move.
Please write a program to implement the weight detector of the elevator.
Input
There are multiple test cases. The first line of input is an integer T indicates the number of test cases. For each test case:
The first line contains two integers N (1 <= N <= 20) and
M (1 <= M <= 2000). The next line contains N integers
Ai (1 <= Ai <= 500).
Output
For each test case, output "Safe" if no alarm will be raised. Otherwise, output "Warning".
Sample Input
Sample Output
[/code]
Elevator
Crawling in process...
Crawling failed
Time Limit:2000MS
Memory Limit:65536KB 64bit IO Format:%lld & %llu
Submit
Status
Practice
ZOJ 3767
Appoint description:
System Crawler (2016-03-02)
Description
How time flies! The graduation of this year is around the corner. N members of ZJU ACM/ICPC Team decided to hold a party in a restaurant. The restaurant is located in a skyscraper so they need to take an elevator to reach there.
The elevator's maximum load is M kilograms. The weight of the i-th team member is
Ai kilograms. If the total weight of people in the elevator exceeds the maximum load of the elevator, the elevator will raise the alarm and will not move.
Please write a program to implement the weight detector of the elevator.
Input
There are multiple test cases. The first line of input is an integer T indicates the number of test cases. For each test case:
The first line contains two integers N (1 <= N <= 20) and
M (1 <= M <= 2000). The next line contains N integers
Ai (1 <= Ai <= 500).
Output
For each test case, output "Safe" if no alarm will be raised. Otherwise, output "Warning".
Sample Input
2 3 800 50 60 70 9 800 50 55 60 60 60 60 65 70 360
Sample Output
Safe Warning
#include<stdio.h> int main() { int T; scanf("%d",&T); while(T--) { int n,w; scanf("%d%d",&n,&w); int i,j; j=0; for(i=0;i<n;i++) { int o; scanf("%d",&o); j+=o; } if(j<=w) printf("Safe\n"); else { printf("Warning\n"); } } return 0; }
[/code]
相关文章推荐
- 保持 RAC 群集环境稳定当前必须要做的 11 件事 (文档 ID 1525819.1)
- 【矩阵加速】【数论】【KMP】[BZOJ1009][HNOI2008]GT考试
- memtest86+4.20流程分析
- 三款新品亮相家博会,卡萨帝新理念获业界认同
- 时间正则表达式小叙
- linux ls -l命令结果含义解析
- 移动客户端网络优化
- 浅谈JS原型对象和原型链
- SEO_关键词研究工具
- 【Unity】Unity中获得碰撞体碰撞的位置
- 总结
- HDU 1693 Eat the Trees 插头DP
- [POJ1273]草地排水 dinic模板
- JWT Token
- 2016蓝桥杯算法提高——01背包
- 整体二分&&bzoj 2738学习笔记
- MVC5 Entity Framework学习之Entity Framework高级功能
- js中实现输入框输入字数提示
- 多线程
- Java struts2国际化,与js资源获取