[CF911C]Three Garlands
题目大意:
给你三个灯,分别以k1秒一次,k2秒一次和k3秒一次的频率闪烁着。
你可以自定义三个灯开启的时间,问是否有一种方案,使得max(k1,k2,k3)秒之后,每秒钟都至少有一盏灯闪烁。
思路:
很显然,当三盏灯频率都大于4秒一次时,不存在答案,那么我们只需要大力讨论4秒以内的情况即可。
#include<cstdio>
#include<cctype>
#include<algorithm>
inline int getint() {
register char ch;
while(!isdigit(ch=getchar()));
register int x=ch^'';
while(isdigit(ch=getchar())) x=(((x<<)+x)<<)+(ch^'');
return x;
}
int main() {
int k1=getint(),k2=getint(),k3=getint();
if(k1>k2) std::swap(k1,k2);
if(k2>k3) std::swap(k2,k3);
if(k1>k2) std::swap(k1,k2);
if(k1==||k2<=||k1==&&k2==&&k3==||k1==&&k2==&&k3==) {
puts("YES");
return ;
}
puts("NO");
return ;
}
[CF911C]Three Garlands的更多相关文章
- Codeforces 707E Garlands
Garlands 我怎么感觉好水啊. 因为询问只有2000组, 离线询问, 枚举联通块再枚举询问, 二维树状数组更新答案. #include<bits/stdc++.h> #define ...
- Codeforces Round #368 (Div. 2) E. Garlands 二维树状数组 暴力
E. Garlands 题目连接: http://www.codeforces.com/contest/707/problem/E Description Like all children, Ale ...
- Three Garlands~Educational Codeforces Round 35
C. Three Garlands time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- Garlands
题意: n个数分成m段,每段偶数个数,最小化和最大段的半个区间的数字和. 分析: 先想到了二分,dp求能分成的最小段数. #include <map> #include <set&g ...
- Codeforces 707 E. Garlands (二维树状数组)
题目链接:http://codeforces.com/problemset/problem/707/E 给你nxm的网格,有k条链,每条链上有len个节点,每个节点有一个值. 有q个操作,操作ask问 ...
- CF368 E - Garlands
主席树 其实暴力二维树状还更快 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int M ...
- Garlands CodeForces - 707E (离线树状数组)
大意: 给定n*m矩阵, k条链, 链上每个点有权值, 每次操作可以关闭或打开一条链或询问一个子矩阵内未关闭的权值和. 关键询问操作比较少, 可以枚举每条链, 暴力算出该条链对每个询问的贡献. 最后再 ...
- 【codeforces 707E】Garlands
[题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...
- CF #368 div2
题目链接:http://codeforces.com/contest/707/problem/A A. Brain's Photos time limit per test 2 seconds mem ...
随机推荐
- Tile Cut~网络流入门题
Description When Frodo, Sam, Merry, and Pippin are at the Green Dragon Inn drinking ale, they like t ...
- codeforces 719C. Efim and Strange Grade
C. Efim and Strange Grade time limit per test 1 second memory limit per test 256 megabytes input sta ...
- 上海GDG活动有感
本周参加了场上海的GDG活动.本次活动的主办方 先介绍一下: GDG Shanghai 上海GDG(Google开发者社区,以前是GTUG, Google技术用户组) ,众所周知,Google的搜索引 ...
- fuser命令找到占用资源的进程
fuser 概述 fuser命令是用来显示所有正在使用着指定的file, file system 或者 sockets的进程信息. 例一: #fuser –m –u /mnt/usb1 /mnt/us ...
- 转:RBAC权限控制
名词解释: RBAC:Role-Based Access Control,基于角色的访问控制 关键词: RBAC,Java Shiro,Spring Security, 一. RBAC 要解决 ...
- Idea工具点滴积累
方法参数提示: keymap里面搜索 quick document,默认是F2
- mongodb安全
1.流程: (1)创建超级管理员 (2)修改配置文件,验证身份登录 (3)重启服务 (4)使用超级管理员登录 (5)创建普通用户 (6)使用普通用户登录对应的数据库 mongodb数据库角色: 1创建 ...
- wxpython SizerItem的大小控制
wxpython SizerItem的大小控制 proportion控制控件相对大小,proportion如果为0,表示默认大小.比如一个box里面有两个相同控件A,B,如果A,B的proportio ...
- Shell Script Basics
https://developer.apple.com/library/mac/documentation/OpenSource/Conceptual/ShellScripting/shell_scr ...
- Hadoop安装过程
1.安装JDK apt-get install openjdk-7-jdk 2.配置环境变量 vim /etc/profile 编辑: export JAVA_HOME=/usr/lib/jvm/ja ...