问题 D: Snowman

时间限制: 1 Sec  内存限制: 128 MB
提交: 203  解决: 94
[提交][状态][讨论版]

题目描述

前言:这是某比赛的热身题,本题主要考察英文水平,只要看懂题意,AC本题会很快!
Welcome to Da Dong Bei kingdom in this winter!
Tang and Jiang are good friends. They are trying to building some snowmen. To build a snowman, i.e., an anthropomorphic snow sculpture, Tang and Jiang have to roll some snowballs respectively. It is known that snow becomes suitable for packing when approaching the melting point, which allows for the construction of a large snowball by simply rolling it, until it grows to the desirable size. However, they don’t know if the snowman is stable with the size they make.
In specific, snowmen are usually built by two spheres, one from Tang, and another from Jiang. Assuming the radius of the upside snowball be R1 and the radius of the downside snowball be R2, a snowman is stably built if 3/2*R1<=R2<=2*R1(R1,R2,are positive).
Tang and Jiang want to know whether there is a feasible case for them to build a steady snowman.

输入

There are multiple test cases.
For each test case, the first line contains two integers N(1<=N<=10) and M(1<=M<=10) indicating the number of snowballs Tang and Jiang rolled respectively; the next two lines have respectively N intergers and M integers separated by spaces, denoting the radius of snowballs they rolled.
You can assume all the integers are not larger than 10000.

输出

For each case, print “Yes” in a single line if there is at least one feasible solution; Print “No” otherwise.

样例输入

2 1
5 10
7
2 1
5 10
6

样例输出

No
Yes

简单数学

#include <cstdio>
int absa(int a)
{return a>0?a:-a;
}
int main()
{int n,m,i,j,flag;int s[11],c[11];while(scanf("%d%d",&n,&m)!=EOF){flag=0;for(i=0;i<n;i++) scanf("%d",&s[i]);for(i=0;i<m;i++) scanf("%d",&c[i]);for(i=0;i<n;i++)for(j=0;j<m;j++){if(absa(s[i]-c[j])>(s[i]+1)/2){printf("Yes\n");flag=1;break;}}for(i=0;i<m;i++)for(j=0;j<n;j++){if(absa(c[i]-s[j])>(c[i]+1)/2){printf("Yes\n");flag=1;break;}}if(!flag)printf("No\n");}return 0;
}

View Code

 

转载于:https://www.cnblogs.com/wandso/p/10062056.html

hnust Snowman相关推荐

  1. HNUST - 数据库课设

    HNUST - Python+Mysql数据库课设 一.实验题目 人事管理系统 二.实验目的 企业人事管理系统主要用于员工个人资料的录入.职务变动的记录和管理.使用人事管理系统,便于公司领导掌握人员的 ...

  2. 问题 A: 相约HNUST

    问题 A: 相约HNUST 时间限制: 1 Sec 内存限制: 128 MB 提交: 332 解决: 127 [提交][状态][讨论版] 题目描述 每年春季的湖南科技大学计算机程序设计竞赛又开始了.我 ...

  3. HNUST 辅导上机(模拟)

    题目描述 又到了辅导学弟学妹们上机的时候了,学长们都非常踊跃报名.那么问题来了,如何安排上机呢?现在将问题简化一下:一共需要n节课(编号从1到n)的辅导上机,正好有n位学长(编号从1到n)报名,用二维 ...

  4. hnust - 聊天表情

    题目描述 聊天时我们经常插入表情符号,如果是连续三个字符":-)"表示高兴,而":-("表示悲伤.给定一段聊天信息,判定其总体的情绪. 输入 仅一行字符串,长度 ...

  5. hnust 神奇的序列

    问题 E: 神奇的序列 时间限制: 1 Sec  内存限制: 128 MB 提交: 635  解决: 84 [提交][状态][讨论版] 题目描述 Aurora在南宁发现了一个神奇的序列,即对于该序列的 ...

  6. HNUST 1438: 称重

    1438: 称重 时间限制: 1 Sec  内存限制: 128 MB 提交: 53  解决: 26 [提交][状态][讨论版] 题目描述 天平上称东西都是用砝码,砝码既可以放左边也可以放右边,现在想知 ...

  7. HNUST OJ 2293 贪吃蛇吃苹果

    问题 J: 贪吃蛇吃苹果 时间限制: 1 Sec  内存限制: 128 MB 题目描述 贪吃蛇(也叫做贪食蛇)游戏是一款休闲益智类游戏,有PC和手机等多平台版本.既简单又耐玩.该游戏通过控制蛇头方向吃 ...

  8. HNUST 1581 聚宝盆

    题目链接:Click here 思路:自己写一下就可以看出是个fib数列,递归求解就好. PS:看动态规划,撇到这个题,想到以前看到了没做出来,所以就试一试,没想到竟然是fib... #include ...

  9. HNUST 计算机组成原理课设

    写在最前的话:总的来说,本次计组课设非常简单,但是需要极大的耐心和细心.这是我们第一次使用Multisim,只要能基本熟练使用Multisim.理解四个实验的原理和操作,要通过老师测试是很简单的. 实 ...

  10. HNUST OJ 2295 嘉嘉的队伍配置

    问题 B: 嘉嘉的队伍配置 时间限制: 1 Sec  内存限制: 128 MB 题目描述 「当你重新踏上旅途之后,一定要记得旅途本身的意义.    提瓦特的飞鸟.诗和城邦,女皇.愚人和怪物--都是你旅 ...

最新文章

  1. Caffe实战二(手写体识别例程:CPU、GPU、cuDNN速度对比)
  2. NYOJ 613 免费馅饼
  3. Java JUC之Atomic系列12大类实例讲解和原理分解
  4. python 用户输入_Python 用户输入(input)
  5. webrender 查看是否开启_想要体验极致顺滑的网页加载体验?手动开启Firefox WebRender渲染引擎...
  6. Exchange 日志/存储路径
  7. 与其临渊羡鱼,不如退而结网
  8. GDI+ is F**king unbelievable
  9. python之collections模块Counter类使用学习
  10. 移动端rem布局实践
  11. 2018年4月蓝桥杯省赛经历
  12. Yolov4-tiny pth转onnx转tensorrt
  13. Python的线程如何理解
  14. NMOS和PMOS管
  15. DST与Neural Belief Tracker
  16. 南邮 OJ 1484 烧饼重叠问题
  17. docker系统中/var/lib/docker/overlay2
  18. python 如何把字符串转换成浮点数
  19. 一起看 I/O | Android 开发者不能错过的 13 件事
  20. 直播礼品_礼品信息打印机

热门文章

  1. php 三个点的用法 function fun (...$arr){}
  2. AndroidX使用
  3. 介绍中国传统节日的网页html,中国传统节日大全表 中国16个传统节日介绍
  4. STM32L476入坑-3-新建工程并点亮LED灯
  5. asuswrt 单臂路由_Padavan(老毛子) 最简单臂路由组网 VLAN 设置
  6. 支付宝手机网站支付接口集成的经验小结
  7. 【C++】交通咨询系统(最短路径问题)
  8. Tushare Day7—— 第19章投资组合理论及拓展
  9. 【牛客网-公司真题-前端入门篇】——百度2021校招Web前端研发工程师笔试卷(第二批)
  10. c 连接oracle otl,C++类库:OTL通用的数据库连接类库