问题 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. N 叉树的层序遍历

    给定一个 N 叉树,返回其节点值的层序遍历. (即从左到右,逐层遍历). 例如,给定一个 3叉树 : 返回其层序遍历: [ [1], [3,2,4], [5,6] ] 说明: 树的深度不会超过 100 ...

  2. redis在Windows下以后台服务一键搭建集群(多机器)

    redis在Windows下以后台服务一键搭建集群(多机器) 一.概述 此教程介绍如何在windows系统中多台机器之间布置redis集群,同时要以后台服务的模式运行.布置以脚本的形式,一键完成.多台 ...

  3. COGS 1453. [USACO NOV]空牛栏

    ★★   输入文件:empty.in   输出文件:empty.out   简单对比时间限制:1 s   内存限制:64 MB [题目描述] FJ建的新牛棚里有N(2<=N<=3,000, ...

  4. php生成纯数字、字母数字、图片、纯汉字的随机数验证码

    现在讲开始通过PHP生成各种验证码旅途,新手要开车了,请刷卡! 首先,我们开始先生成一个放验证码的背景图片 注:没有Imagejpg()这个函数,只有imagepng()函数 imagecreatet ...

  5. Win7系统如何设置FTP详细过程

    1.安装FTP组件 点击:控制面板—>程序和功能—>打开或关闭Windows功能.勾选“FTP服务器”及“FTP服务”“FTP扩展性”,点击“确定”,安装FTP组件. 2.添加FTP站点 ...

  6. [转载]AngularJS入门教程01:静态模板

    为了说明angularJS如何增强了标准HTML,我们先将创建一个静态HTML页面模板,然后把这个静态HTML页面模板转换成能动态显示的AngularJS模板. 在本步骤中,我们往HTML页面中添加两 ...

  7. autoreleasing on a thread

    So basically, if you are running on OS X 10.9+ or iOS 7+, autoreleasing on a thread without a pool s ...

  8. python_37_文件修改

    f=open('yesterday','r',encoding='utf-8') f_new=open('yesterday_update','w',encoding='utf-8') for lin ...

  9. oc字典放入到数组里,根据字典里的属性排序(重点)

    #import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @autoreleasepool { ...

  10. JSTree下的模糊查询算法——树结构数据层次遍历和递归分治地深入应用

    A表示区域节点,S表示站点结点 问题描述:现有jstree包含左图中的所有结点信息(包含区域结点和站点结点),需要做到输入站点名称模糊查询,显示查询子树结果如右图 解决策略: 1.先模糊查询所得站点所 ...