HDU5874
Friends and Enemies
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 171 Accepted Submission(s): 100
Problem Description
For any two dwarves, if they are friends, at least one of the stones from each of their necklaces are of the same color; and if they are enemies, any two stones from each of their necklaces should be of different colors. Note that a necklace can be empty.
Now, given the population and the number of colors of stones on the island, you are going to judge if it's possible for each dwarf to prepare himself a necklace.
Input
For each test case, the one and only line contains 2 positive integers M,N (M,N<231) representing the total number of dwarves (not including the king) and the number of colors of stones on the island.
Output
Sample Input
Sample Output
Source
//2016.9.10
#include <iostream>
#include <cstdio> using namespace std; long long fun(int m)
{
long long ans;
ans = (m/)*(m/);
if(m%)ans += (m/);
return ans;
} int main()
{
long long n, m, res;
while(scanf("%lld%lld", &m, &n)!=EOF)
{
res = fun(m);
if(n>=res)
printf("T\n");
else printf("F\n");
} return ;
}
HDU5874的更多相关文章
- HDU5874:Friends and Enemies
题目链接: Friends and Enemies 分析: 是一道想法题,我们假设x个人互相敌对,然后有y个人与这x个人都是朋友,而这y个人互相敌对. 则有 x+y=m x*y<=n 举个例子: ...
随机推荐
- php单元测试到底是什么东西呢?
前言: 真正写php代码也有3年时间了,勉强算是一个php程序员, 但是,心底却一直没有底气. 都说测试驱动开发,可我连程序开发中什么是单元测试?这种基本的程序员的素养都 还不是很清楚,痛定思痛,决定 ...
- ibatis的动态sql
1.介绍 <select id="getUsers" parameterClass="user" resultMap="get-user-res ...
- Dom编程(三)
简单菜单制作,参考代码: var ul = document.getElementById("parent"); var lis = ul.getElementsByTagName ...
- OPENCV图像变换-2
一.经典霍夫变换 霍夫变换是图像处理中的一种特征提取技术,该方法通过在一个参数空间中通过计算累计结果的局部最大值来得到一个符合该特定形状的集合,作为结果. 运用两个坐标空间之间的变换,将一个空间中具有 ...
- 在Android studio环境下使用EventBus
EventBus是一个订阅/发布消息总线,实现在应用程序里面,组件之间,线程之间的通信.因为event是任意的类型,所以这个使用起来非常方便. eventbus中的角色: event:当然就是事件啦 ...
- STM8的GPIO驱动
芯片的外设一般按照这么几个流程来进行,GPIO,外部中断,定时器,串口,ADC,IIC,SPI,下面我就按照各个模式来写 首先是GPIO,STM8的GPIO拥有复用功能,这句话告诉我们必然需要配置IO ...
- 了解HTML/HTML5中的download属性
一.download属性是个什么鬼? 首先看下面这种截图: 如果我们想实现点击上面的下载按钮下载一张图片,你会如何实现? 我们可能会想到一个最简单的方法,就是直接按钮a标签链接一张图片,类似下面这样: ...
- 3)Java学习笔记:内部类
什么是内部类 内部类是指在一个外部类的内部再定义一个类.内部类作为外部类的一个成员,并且依附于外部类而存在的.内部类可为静态,可用protected和private修饰(而外部类只能使用public和 ...
- UVa 483 - Word Scramble
题目大意:给一个由单词组成的句子,只反转单词内部的次序而不改变单词之间的次序.如“I love you.”转换成“I evol .uoy”. #include <cstdio> #incl ...
- bzoj3809
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3809 题目大意: Autumn和Bakser又在研究Gty的妹子序列了!但他们遇到了一个难题 ...