ZOJ3767 Elevator 2017-04-13 23:32 37人阅读 评论(0) 收藏
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) 收藏的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 记一个神奇的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 ...
- *** glibc detected *** malloc(): memory corruption 分类: C/C++ Linux 2015-05-14 09:22 37人阅读 评论(0) 收藏
*** glibc detected *** malloc(): memory corruption: 0x09eab988 *** 发现是由于memset越界写引起的. 在Linux Server上 ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- Django Admin定制
Django内置的Admin是对于model中对应的数据表进行增删改查提供的组件,使用方式有: 依赖APP: django.contrib.auth django.contrib.contenttyp ...
- 设置JAVA HOME环境变量的秕处理
echo "放在JDK目录下,win xp需要下载SETX.EXE" setx /m Java_Home "%cd%" setx /m ClassPath &q ...
- MTU&MSS
MTU是Maximum Transmission Unit的缩写,意为最大传输单元,通俗的理解就是在网络上传送的最大数据包,单位是字节. 以太网对数据帧的长度都有一个限制,其最大值为1500,这个特性 ...
- MySQL 通用查询日志(General Query Log)
同大多数关系型数据库一样,日志文件是MySQL数据库的重要组成部分.MySQL有几种不同的日志文件,通常包括错误日志文件,二进制日志,通用日志,慢查询日志,等等.这些日志可以帮助我们定位mysql ...
- CUDA 新版本 Visual Studio 和 CUDA 兼容性的小问题
▶ 升级到 Visual Studio 2017 和 CUDA 9.1 之后,直接编译以前的 CUDA C 程序出现了如下报错: 严重性 代码 说明 项目 文件 行 禁止显示状态 错误(活动) E00 ...
- 206. Reverse Linked List + 92. Reverse Linked List II
▶ 关于单链表翻转的两个问题. ▶ 206. 翻转整个单链表. ● 自己的代码,9 ms,使用了递归. class Solution { public: ListNode* reverseList(L ...
- C# 中带有中国农历的日期选择控件
开源一款自己刚开始接触 C# 时开发的带有农历信息的日期选择控件,记得那时还是在2010年的寒假期间做的这个东西.刚开始接触 C# 时,使用WinForm来开发桌面程序,觉得简直是简单又迅速,由于 C ...
- 使用python读取大文件
python中读取数据的时候有几种方法,无非是read,readline,readlings和xreadlines几种方法,在几种方法中,read和xreadlines可以作为迭代器使用,从而在读取大 ...
- 【转】Unity Scene场景自定义坐标轴
来自:https://blog.csdn.net/cheng624/article/details/70859054 多看看别人的代码是没有坏处的,即使学不了人家的大框架,偶尔拾起一些小东西也是可以的 ...
- VML元素的相关资料
虽然VML已经过气了,但有时我还不得不使用它,下面是我收集或研究得到的一些东西. 判定一个元素是否为VML元素 function isVML(el) { if (el && el.no ...