hdu 5874
On an isolated island, lived some dwarves. A king (not a dwarf) ruled the island and the seas nearby, there are abundant cobblestones of varying colors on the island. Every two dwarves on the island are either friends or enemies. One day, the king demanded that each dwarf on the island (not including the king himself, of course) wear a stone necklace according to the following rules:
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.InputMultiple test cases, process till end of the input.
For each test case, the one and only line contains 2 positive integers M,N (M,N<231)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.OutputFor each test case, The one and only line of output should contain a character indicating if it is possible to finish the king's assignment. Output ``T" (without quotes) if possible, ``F" (without quotes) otherwise.Sample Input
20 100
Sample Output
T
很简单的一道题,当所有人构成二分图的时候,需要的颜色最多。
附ac代码:
1 #include <cstdio>
2 #include <iostream>
3 #include <cmath>
4 #include <cstring>
5 #include <algorithm>
6 #define ll long long
7 const int maxn = 1000+10;
8 using namespace std;
9
10 int main() {
11
12 ll n,m;
13 while(~scanf("%lld %lld",&n,&m))
14 {
15 if(((n+1)/2)*(n/2)<=m)
16 printf("T\n");
17 else
18 printf("F\n");
19 }
20
21 return 0;
22 }
hdu 5874的更多相关文章
- HDU 5874 Friends and Enemies 【构造】 (2016 ACM/ICPC Asia Regional Dalian Online)
Friends and Enemies Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Othe ...
- HDU 5874 Friends and Enemies
Friends and Enemies Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Othe ...
- hdu 5874 Friends and Enemies icpc大连站网络赛 1007 数学
#include<stdio.h> #include<iostream> #include<algorithm> #include<math.h> #i ...
- HDU 5876 Sparse Graph 【补图最短路 BFS】(2016 ACM/ICPC Asia Regional Dalian Online)
Sparse Graph Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)To ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
随机推荐
- cts project的创建修改和删除
事务码:SPRO_ADMIN进入 项目管理界面,点击工具栏创建项目(F5),弹出对话框,输入项目名称,回车确定. 标题中输入项目的描述.点击保存.如图: 点击图片放大 注:要想此项目在CTS建立请求的 ...
- Git 创建新分支检查分支
创建分支和切换分支,也可以称为检出分支 创建新分支 git branch branchName 切换到新分支 git checkout branchName 上面两个命令也可以合成为一个命令: git ...
- 转 jmeter测试手机号码归属地
jmeter测试手机号码归属地 jmeter测试手机号码归属地接口时,HTTP请求有以下两种书写方法: 1.请求和参数一同写在路径中 2.参数单独写在参数列表中 请求方法既可以使用GET方法又可以 ...
- JavaScript常用API
JavaScript常用API 节点属性 文档节点 事件监听.一出事件 获取元素方法
- 变量隐藏Accidental Variable Shadowing
6.5 - Variable shadowing (name hiding) | Learn C++ https://www.learncpp.com/cpp-tutorial/variable-sh ...
- Django Admin后台添加用户时出现报错:1452
如果在使用Django Admin后台添加用户时出现报错: (1452, 'Cannot add or update a child row: a foreign key constraint fai ...
- 洛谷P4180
被教练安排讲题 可恶 这道题我是十月初上课时花了一下午做出来的,当时连倍增都不会,过程比较困难,现在看看还可以 本来想口胡一发,后来想了想可能以后要用,还是写成文章吧 Description 求一棵严 ...
- Eclipse插件springsource-tool-suite的下载和安装
根据佟刚Spring课程,装完这个插件,再利用maven构建工程,爽 课程:https://www.bilibili.com/video/av21335209?from=search&seid ...
- Java之五种遍历Map集合的方式
摘要:在java中所有的map都实现了Map接口,因此所有的Map都可以用以下的方式去遍历. 在java中所有的map都实现了Map接口,因此所有的Map都可以用以下的方式去遍历.这篇文章主要给大家介 ...
- 剖析 CopyOnWriteArrayList
原文链接:https://www.changxuan.top/?p=1252 CopyOnWriteArrayList 是 JUC 中唯一一个支持并发的 List. CopyOnWriteArrayL ...