问题 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>?a:-a;
}
int main()
{
int n,m,i,j,flag;
int s[],c[];
while(scanf("%d%d",&n,&m)!=EOF)
{
flag=;
for(i=;i<n;i++) scanf("%d",&s[i]);
for(i=;i<m;i++) scanf("%d",&c[i]);
for(i=;i<n;i++)
for(j=;j<m;j++)
{
if(absa(s[i]-c[j])>(s[i]+)/)
{
printf("Yes\n");
flag=;
break;
}
}
for(i=;i<m;i++)
for(j=;j<n;j++)
{
if(absa(c[i]-s[j])>(c[i]+)/)
{
printf("Yes\n");
flag=;
break;
}
}
if(!flag)
printf("No\n");
}
return ;
}
 

hnust Snowman的更多相关文章

  1. 雪人(snowman)

    test1025 五子棋(fir) 依照题意模拟即可,先判是否合法,然后在判是否胜利 迷宫(maze) 折半搜素裸题 雪人(snowman) 二分+hash a1-b1=a2-b2=a3-b3 等价于 ...

  2. hnust 分蛋糕

    问题 B: 分蛋糕 时间限制: 1 Sec  内存限制: 128 MB提交: 2430  解决: 966[提交][状态][讨论版] 题目描述 今天是DK生日,由于DK的朋友很多,所以DK在蛋糕店定制了 ...

  3. hnust 神奇的序列

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

  4. hnust py road

    问题 C: Py Road 时间限制: 1 Sec  内存限制: 128 MB提交: 125  解决: 34[提交][状态][讨论版] 题目描述 Life is short,you need Pyth ...

  5. hnust 好友互动标识

    问题 A: 好友互动标识 时间限制: 1 Sec  内存限制: 128 MB提交: 897  解决: 122[提交][状态][讨论版] 题目描述       QQ有一个有趣的功能即显示好友互动标识,它 ...

  6. hnust 原石法阵

    问题 F: 原石法阵 时间限制: 1 Sec  内存限制: 128 MB提交: 1098  解决: 161[提交][状态][讨论版] 题目描述 WZH有一个由原石构成的n阶三角形魔法阵,三角形魔法阵如 ...

  7. hnust 最小的x

    问题 G: 最小的x 时间限制: 1 Sec  内存限制: 128 MB提交: 2347  解决: 1155[提交][状态][讨论版] 题目描述 TSQ对DK进行地狱式训练,找出满足下面公式的最小的x ...

  8. hnust 罚时计算器

    问题 F: 罚时计算器 时间限制: 1 Sec  内存限制: 128 MB提交: 229  解决: 63[提交][状态][讨论版] 题目描述 一般 ACM程序设计比赛都是五个小时.但是比赛结束时,DB ...

  9. hnust 档案管理

    问题 E: 档案管理 时间限制: 1 Sec  内存限制: 128 MB提交: 274  解决: 105[提交][状态][讨论版] 题目描述 X老师管理着学校的档案室,经常会有其他的老师来档案室存文件 ...

随机推荐

  1. 解决“SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT 'OpenRowset/OpenDatasource' 的访问……”【转】

    SQL Server 阻止了对组件 /'Ad Hoc Distributed Queries/' 的访问 在Sql Server中查询一下Excel文件的时候出现问题: SELECT *  FROM ...

  2. pyinstaller打包python源程序访问hive

    1.需求 使用hvie server一段时间后,业务部门需要自己不定时的查询业务数据,之前这一块都是他们提需求我们来做,后来发现这样重复一样的工作放在我们这边做是在没有效率,遂提出给他们工具或者web ...

  3. TTTAttributedLabel颜色设置

    NSString *text = @"Lorem ipsum dolor sit amet"; [self.testAttributedLabel setText:text aft ...

  4. codeforces 600A Extract Numbers

    模拟题,意思是一个字符串,单词直接用','或';'来分割,可以为空,把不含前导0的整数和其他单词分别放入A和B.按照一定格式输出. 没有用stl的习惯.维护两个下标i,j,表示开区间(i,j),两段补 ...

  5. Object comparison - (BOOL)isEqual:(id)other

    https://developer.apple.com/library/content/documentation/General/Conceptual/DevPedia-CocoaCore/Obje ...

  6. EL和JSTL表达式学习记录

    EL.JSTL表达式EL:1.EL使用目的:代替jsp页面中java脚本编写 2.EL作用:(1)从域中取出数据(最重要)(2)EL的内置对象(11个)(3)EL可以执行表达式运算 JSTL(JSP标 ...

  7. tensorfow install error

    http://stackoverflow.com/questions/33655731/error-while-importing-tensorflow-in-python2-7-in-ubuntu- ...

  8. Oracle 函数 之 Coalesce()、greatest()、least()

    Coalesce().greatest().least() oracle比较一列的数据大小时,我们一般使用max()/min()函数,比较一行的最大值或者最小值时,使用函数Coalesce()/gre ...

  9. Linux网络编程之"获取网络天气信息"

    需求分析: 1.需要Linux c 网络编程基础, 2.需要了解 http 协议 3.需要天气信息相关api(可以从阿里云上购买,很便宜的!) 4.需要cJSON解析库(因为获取到的天气信息一般是用c ...

  10. Spring Cloud学习介绍

    最近在学spring cloud, 整理了下 简单知识要求: 1.要了解springboot 2.了解分布式架构 3.了解微服务 4.了解springcloud是做什么的 带着这些,初学者 就至少有个 ...