问题 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. extends 继承

    继承的作用:子类可以直接拥有父类成员:其中,私有成员和构造函数不参与继承: java中类继承的特点:只支持单一继承和多重继承,不支持多继承(一个类不能同时继承多个类) 继承中成员变量的特点:子类中可以 ...

  2. python 之 BeautifulSoup 常用提取

    一.bs4信息提取后返回的数据类型 soup.find('tbody') ---> 返回结构是一个bs4.element.Tag soup.find('tbody').children ---& ...

  3. mybatis-映射器的CRUD

    设计步骤:model.mapper.dao.service.junit单元测试.log4j日志 项目和之前的一样在此只是创建了test和修改了mapper 1.修改映射 1.1修改接口 package ...

  4. HDU 1028 Ignatius and the Princess III伊格和公主III(AC代码)母函数

    题意: 输入一个数n,求组合成此数字可以有多少种方法,每一方法是不记录排列顺序的.用来组成的数字可以有1.2.3....n.比如n个1组成了n,一个n也组成n.这就算两种.1=1,2=1+1=2,3= ...

  5. UVA 215 Spreadsheet Calculator (模拟)

    模拟题.每个单元格有表达式就dfs,如果有环那么就不能解析,可能会重复访问到不能解析的单元格,丢set里或者数组判下重复. 这种题首先框架要对,变量名不要取的太乱,细节比较多,知道的库函数越多越容易写 ...

  6. Handling Exceptions

    https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Exceptions/Tasks/Handling ...

  7. 【HHHOJ】NOIP模拟赛 捌 解题报告

    点此进入比赛 得分: \(30+30+70=130\)(弱爆了) 排名: \(Rank\ 22\) \(Rating\):\(-31\) \(T1\):[HHHOJ260]「NOIP模拟赛 捌」Dig ...

  8. 使用FolderBrowserDialog组件选择文件夹

    实现效果: 知识运用: FolderBrowserDialog组件的ShowDialog方法 //弹出选择路径对话框 public DialogResult ShowDialog() 和Selecte ...

  9. python_35_进度条

    import sys for i in range(50): sys.stdout.write("+")#此命令不会像print语句执行一次,换行一次\ sys.stdout.fl ...

  10. PAT (Basic Level) Practise (中文)- 1005. 继续(3n+1)猜想 (25)

    http://www.patest.cn/contests/pat-b-practise/1005 卡拉兹(Callatz)猜想已经在1001中给出了描述.在这个题目里,情况稍微有些复杂. 当我们验证 ...