ZOJ3767-Elevator
来源:互联网 发布:软件层次结构图 编辑:程序博客网 时间:2024/06/15 10:13
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
Author: YU, Xiaoyao; JIANG, Kai
Source: The 14th Zhejiang University Programming Contest
题意:一个电梯,电梯最大承重,n个人,每个人重量告诉你,然后问你超重没有
#include <iostream>#include <cstdio>#include <cstring>#include <string>#include <algorithm>#include <cmath>using namespace std;int a[25];int n,m;int main(){ int t; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&m); int sum=0; for(int i=1;i<=n;i++) { scanf("%d",&a[i]); sum+=a[i]; } if(sum<=m) printf("Safe\n"); else printf("Warning\n"); } return 0;}
- ZOJ3767:Elevator
- ZOJ3767 Elevator
- ZOJ3767-Elevator
- Elevator
- Elevator
- Elevator
- elevator
- Elevator
- Elevator
- Elevator
- Elevator
- Elevator
- elevator
- Elevator
- Elevator
- Elevator
- Elevator
- Elevator
- RecyclerView/ScrollView中条目弹出PopupMenu导致RecyclerView自动滚动的问题
- windows10常用快捷键
- my choice
- FWT 模板
- 题目1117:整数奇偶排序
- ZOJ3767-Elevator
- 获取ApplicationContext的方法及手动控制事务提交
- OracleDB的数据库名,实例名,服务名,数据库域名,全局数据库名的简单介绍
- SVN环境下快速导出增量包(未提交的情况下)
- Unity基础UI--Image
- 数据结构图之五(拓扑排序)
- POJ 1276 Cash Machine(?)
- 【测试】软件测试的流程图&&软件测试基本概念
- TensorFlow函数——tf.variable( )