问题 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. CUDA:Supercomputing for the Masses (用于大量数据的超级计算)-第三节

    原文链接 第三节:错误处理和全局内存性能局限 恭喜!通过对CUDA(Compute Unified DeviceArchitecture,即计算统一设备架构的首字母缩写)系列文章第一节和第二节,您现在 ...

  3. Bootstrap 弹出框(Popover)插件

    Bootstrap 弹出框(Popover)插件与Bootstrap 提示工具(Tooltip)插件类似,提供了一个扩展的视图,用户只需要把鼠标指针悬停到元素上面即可.弹出框的内容完全由Bootstr ...

  4. C# 创建子目录

    运用DirectoryInfo类创建子目录是非常容易的,你只要调用其中CreateSubdirectory()方法即可,演示代码如下. DirectoryInfo dir = new Director ...

  5. 一次线上CPU高的问题排查实践

    一次线上CPU高的问题排查实践 前言 近期某一天上班一开电脑,就收到了运维警报,有两台服务CPU负载很高,同时收到一线同事反馈 系统访问速度非常慢,几乎无响应. 一个美好的早晨,最怕什么就来什么.只好 ...

  6. 3_HA介绍和安装部署

    一.hadoop 2.x产生背景 1.hadoop 1.x中hdfs和mr在高可用和扩展性等方面存在问题.2.hdfs存在的问题:NN单点故障,难以应用于在线场景:NN压力过大,内存受限,影响系统扩展 ...

  7. DOS当中的基本操作命令,如何切换磁盘,如何查看文件和文件夹,如何清屏,进入文件夹的命令,javac是什么意思,作用是什么?DOS如何建文件夹?退出文件夹?

    如何切换磁盘:使用盘符+:举例 d: 如何查看文件和文件夹 dir/w 如何清屏: cls (clear screen) 进入文件夹的命令cd ,举例cd JDK javac是什么意思,c 是comp ...

  8. SummerVocation_Learning--StringBuffer类

    java.lang.StringBuffer代表可变的字符序列.与String类基本类似. 常见的构造方法: StringBuffer(),创建一个不包含字符序列的空的StringBuffer对象. ...

  9. 什么是 TCP/IP?

    前言: 精通 TCP/IP,熟练使用 Socket 进行网路编程. 看到这句话,有没有感到很熟悉呀?相信很多人在投递简历的时候都看到过这条要求,很多人会觉得我们在实际开发中一般用不到这些知识,所以对这 ...

  10. tcl之变量-数组array