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 ...
随机推荐
- window.open()打开新窗口教程
使用 window 对象的 open() 方法可以打开一个新窗口.用法如下: window.open (URL, name, features, replace) 参数列表如下: URL:可选字符串, ...
- Java自学笔记之学生管理系统
实现:学生管理系统,实现学生信息的添加.修改.查询和删除功能 涉及:集合的基础知识(集合遍历,值得获取与替换,set/get方法) 代码如下: Student文件 1 package Demo_120 ...
- 阿里云VOD(二)
一.准备工作 1.设置不转码 测试之前设置默认"不转码",以节省开发成本 2.找到子账户的AccessKey ID 3.给子账户添加授权 AliyunVODFullAccess 4 ...
- [阿里DIEN] 深度兴趣进化网络源码分析 之 Keras版本
[阿里DIEN] 深度兴趣进化网络源码分析 之 Keras版本 目录 [阿里DIEN] 深度兴趣进化网络源码分析 之 Keras版本 0x00 摘要 0x01 背景 1.1 代码进化 1.2 Deep ...
- C++11中string与数值类型的转换
C++中string与数值类型的相互转换记录 string转int.double.long string s = "123.456"; // string -> int co ...
- python多线程和GIL全局解释器锁
1.线程 线程被称为轻量级进程,是最小执行单元,系统调度的单位.线程切换需要的资源一般,效率一般. 2.多线程 在单个程序中同时运行多个线程完成不同的工作,称为多线程 3.并 ...
- 超详细oracle 11g安装步骤 win版本
1. 打开网址: https://edelivery.oracle.com 使用oracle 任意账号登录 账号:2696671285@qq.com 密码:Oracle123 感谢来自某位好心大佬的共 ...
- CF1433F Zero Remainder Sum
写在前面 思维难度不是很大的 DP,代码实现也很容易. 状态设计模式很套路,转移也很好理解. 算法思路 (因为 \(k\) 是常用的循环变量,下文中将题面中的模数改为 \(p\)) 虽然要求的是模 \ ...
- Linux 文件搜索神器 find 实战详解,建议收藏!
大家好,我是肖邦,这是我的第 10 篇原创文章. 在 Linux 系统使用中,作为一个管理员,我希望能查找系统中所有的大小超过 200M 文件,查看近 7 天系统中哪些文件被修改过,找出所有子目录中的 ...
- Centos7部署FytSoa项目至Docker——第三步:部署程序
FytSoa项目地址:https://gitee.com/feiyit/FytSoaCms 部署完成地址:http://82.156.127.60:8000/ 我买的是一年99标准型SA2云服务器 购 ...