ZOJ 3767 Elevator
来源:互联网 发布:淘宝支出统计 编辑:程序博客网 时间:2024/06/11 01:59
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
23 80050 60 709 80050 55 60 60 60 60 65 70 360
Sample Output
SafeWarning
本题题意为给出T组样例,每组样例先给出两个数N,M
随后给出N个人的重量,如果这N个数的和大于M,则输出Warning,否则输出Safe.
#include <iostream>using namespace std;int main(){ int t; cin>>t; int n,m; while(t--) { cin>>n>>m; int sum=0; for(int i=1;i<=n;i++) { int a; cin>>a; sum+=a; } if(sum>m) cout<<"Warning"<<endl; else cout<<"Safe"<<endl; } return 0;}
- ZOJ 3767 Elevator
- ZOJ 3767-Elevator
- zoj-3767-Elevator
- ZOJ 3767 Elevator
- ZOJ 3767 Elevator
- ZOJ 3767 Elevator(水题)
- zoj 2108 Elevator
- ZOJ 2108 Elevator
- ZOJ 2108 Elevator
- ZOJ 2108 Elevator
- Elevator(Zoj 2108)
- zoj 2108 Elevator
- zoj 2108 Elevator(水~)
- 第14届浙江大学程序设计竞赛 A. Elevator(ZOJ 3767)
- ZOJ 2108 Elevator (模拟题)
- Elevator
- Elevator
- Elevator
- python对象的引用特征和可变性
- 在一个div上同时使用百度地图bmap和Echarts
- d3.js 简介和安装
- ABAP 基本语法
- JS算法 GPS国际坐标转换成高德火星坐标
- ZOJ 3767 Elevator
- Spring学习-26:Spring中的JDBC Template(JDBC模板):完成增删改的操作
- 隐藏极深的空指针-
- angular 缓存post请求的方法
- Opencv中灰度图像和imread的区别
- 一刻钟精通正则表达式
- win10安装与破解loadrunner一系列问题
- linux进程状态浅析
- 【洛谷P3694】邦邦的大合唱站队/签到题