Elevator


Time Limit: 2 Seconds      Memory Limit: 65536 KB


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 <iostream>
#include <cstdio>
using namespace std; int main()
{
int T,n,m,sum,a;
scanf("%d",&T);
while(T--)
{
scanf("%d%d",&n,&m);
int sum=0;
for(int i=0;i<n;i++)
scanf("%d",&a),sum+=a;
if(sum<=m)
printf("Safe\n");
else
printf("Warning\n");
}
return 0;
}

ZOJ3767 Elevator 2017-04-13 23:32 37人阅读 评论(0) 收藏的更多相关文章

  1. HDU2680 Choose the best route 最短路 分类: ACM 2015-03-18 23:30 37人阅读 评论(0) 收藏

    Choose the best route Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Ot ...

  2. ZOJ2482 IP Address 2017-04-18 23:11 44人阅读 评论(0) 收藏

    IP Address Time Limit: 2 Seconds      Memory Limit: 65536 KB Suppose you are reading byte streams fr ...

  3. PAT甲 1008. Elevator (20) 2016-09-09 23:00 22人阅读 评论(0) 收藏

    1008. Elevator (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue The highest ...

  4. hdu 1034 (preprocess optimization, property of division to avoid if, decreasing order process) 分类: hdoj 2015-06-16 13:32 39人阅读 评论(0) 收藏

    IMO, version 1 better than version 2, version 2 better than version 3. make some preprocess to make ...

  5. 记一个神奇的WAS问题:sibuswsgw-sibuswsgw_console.jar invalid LOC header (bad signature) 分类: WebSphere 2015-08-06 23:21 9人阅读 评论(0) 收藏

    今天晚上,出现了一个神奇的WAS问题,详细问题异常信息如下: [15-8-6 22:13:29:146 CST] 00000013 ApplicationMg A WSVR0203I: 应用程序:is ...

  6. *** glibc detected *** malloc(): memory corruption 分类: C/C++ Linux 2015-05-14 09:22 37人阅读 评论(0) 收藏

    *** glibc detected *** malloc(): memory corruption: 0x09eab988 *** 发现是由于memset越界写引起的. 在Linux Server上 ...

  7. NYOJ-235 zb的生日 AC 分类: NYOJ 2013-12-30 23:10 183人阅读 评论(0) 收藏

    DFS算法: #include<stdio.h> #include<math.h> void find(int k,int w); int num[23]={0}; int m ...

  8. Hdu 1009 FatMouse' Trade 2016-05-05 23:02 86人阅读 评论(0) 收藏

    FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tot ...

  9. PAT甲 1029. Median (25) 2016-09-09 23:11 27人阅读 评论(0) 收藏

    1029. Median (25) 时间限制 1000 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given an incr ...

随机推荐

  1. bzoj 3159: 决战

    Description 树上链翻转,链加,查询链上的和/max/min 树链剖分套treap,修改查询可以用类似线段树的写法,翻转可以利用分裂合并和翻转标记实现,时间复杂度O(nlog2n) 实测除了 ...

  2. unittest框架出报告乱码的问题解决

    跟着上面的步骤修改好后,unittest断言写法要写成下面这样才能展示非乱码

  3. Charles使用1

    Charles是一款比较常用的全平台的网络封包街区工具,而我们在做移动开发的时候,我们为了调试.测试.分析等目的,经常需要和服务端的网络通讯协议打交道.Charles可以帮我们截取网络数据包来进行分析 ...

  4. laravel上传文件到七牛云存储

    背景 最近在用PHP和laravel框架做一个图片网站,需要将图片存贮到云端,搜索下了对比了下功能,发现七牛云存储不错(主要小流量免费),便选择使用七牛作为图片存储空间. 要实现的功能很简单,选择本地 ...

  5. 读取配置文件工具demo

    //读取配置文件public class ResourcesUtils { /* * @description:根据属性获取文件名 * * @param:propertyName文件的属性名 * * ...

  6. 给iOS开发新手送点福利,简述UIActivityIndicatorView的属性和用法

    UIActivityIndicatorView 1.   activityIndicatorViewStyle 设置指示器的样式 UIActivityIndicatorViewStyleWhiteLa ...

  7. MySQL与PostgreSQL相比哪个更好?

    网上已经有很多拿PostgreSQL与MySQL比较的文章了,这篇文章只是对一些重要的信息进行下梳理.在开始分析前,先来看下这两张图: MySQL MySQL声称自己是最流行的开源数据库.LAMP中的 ...

  8. 利用MessageFormat实现短信模板的匹配

    其实没什么技术含量,因为老是想不起来,所以在此文做下记录. 通常我们的应用系统中都会有很多短信的发送,或者是信息邮件等的推送,而这些信息却有着相同的共性,比如只是用户名换了下. 像下面这条,除了红色字 ...

  9. -bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory

    -bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory python多版本造成额问题 找不到p ...

  10. 如何量化考核技术人的 KPI?

    如何量化考核技术人的 KPI? 原创: 张建飞 阿里技术今天 阿里妹导读:对技术人来说,技术是成长的"核心".然而,在实际工作协作中,技术的重要性常常被业务所掩盖,造成先业务后技术 ...