ZOJ 3767 Elevator(水题)

来源:互联网 发布:2016 7.12南海 知乎 编辑:程序博客网 时间:2024/06/03 16:50

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 Aikilograms. 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

题解:

很水的一题,贴诗:

      静夜思
李白
床前明月光,疑是地上霜。
举头望明月,低头思故乡。

代码:

#include<stdio.h>#include<string.h>#include<stdlib.h>#include<queue>#include<stack>#include<math.h>#include<vector>#include<map>#include<set>#include<stdlib.h>#include<cmath>#include<string>#include<algorithm>#include<iostream>#include<stdio.h>using namespace std;#define ll long long#define maxn 100008int main(){    int test,i,j,n,m,s,x;    while(scanf("%d",&test)!=EOF)    {        while(test--)        {            s=0;            scanf("%d%d",&n,&m);            for(i=0;i<n;i++)            {                scanf("%d",&x);                s+=x;            }            if(s>m)            {                printf("Warning\n");            }            else                printf("Safe\n");        }    }    return 0;}


阅读全文
'); })();
0 0
原创粉丝点击
热门IT博客
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 朋友歌词臧天朔 朋友的英文单词怎么写 朋友的歌词全部 朋友是什么概念 朋友的歌词是什么 朋友英语怎么写 朋友英文怎么写 朋友是什么排比句 真正朋友的含义 朋友经典语录 朋友无印良品 朋友 无印良品 朋友是什么意思 朋友英语怎么读 男朋友的朋友 送朋友的女朋友什么礼物好 朋友结婚 送什么礼物 朋友介绍女朋友 女朋友说做朋友 找男女朋友的网站 男性朋友生日礼物 张爱玲朋友炎樱 pengyou 交朋友的名言 怎么样才能交朋友 什么是真正的朋友 女朋友的男性朋友 送礼物给男性朋友 什么才是真正的朋友 朋客榨汁机 朋客 榻上之奴by陶瓷苏朋客 为寿 寿 祝寿 朋弟 朋什么意思 朋比 朋禾 朋辈 朋辈心理辅导