Codeforces Round #461 (Div. 2) C. Cave Painting
C. Cave Painting
time limit per test 1 second
memory limit per test 256 megabytes
Problem Description
Imp is watching a documentary about cave painting.
Some numbers, carved in chaotic order, immediately attracted his attention. Imp rapidly proposed a guess that they are the remainders of division of a number n by all integers i from 1 to k. Unfortunately, there are too many integers to analyze for Imp.
Imp wants you to check whether all these remainders are distinct. Formally, he wants to check, if all , 1 ≤ i ≤ k, are distinct, i. e. there is no such pair (i, j) that:
1 ≤ i < j ≤ k,
, where is the remainder of division x by y.
Input
The only line contains two integers n, k (1 ≤ n, k ≤ 1018).
Output
Print “Yes”, if all the remainders are distinct, and “No” otherwise.
You can print each letter in arbitrary case (lower or upper).
Examples
Input
4 4
Output
No
Input
5 3
Output
Yes
Note
In the first sample remainders modulo 1 and 4 coincide.
解题心得:
- 题意就是用n分别mod1….k,余数是否会出现重复的。
- 看到数据量1e18也就不可能用什么算法了。瞎搞+特判。感觉比B题还简单一些,在比赛的时候头脑昏昏的,循环倒着写(从大到小),特判贼多,第二早起来还TLE到51组,循环正着写(从小到大)不是挺好的吗,直接AC。
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
map<ll,ll> maps;
int main() {
ll n, m;
scanf("%lld%lld", &n, &m);
bool flag = false;
ll Min = min(n-1,m);
if(m >= n)
Min = m;
if(n%2 == 0 && Min >= 2)
flag = true;
for(ll i=1;i<=Min;i++){
if(maps[n%i] == 1)
flag = true;
else
maps[n%i] = 1;
if(flag)
break;
}
if(flag)
printf("No\n");
else
printf("Yes\n");
return 0;
}
Codeforces Round #461 (Div. 2) C. Cave Painting的更多相关文章
- CF922 CodeForces Round #461(Div.2)
CF922 CodeForces Round #461(Div.2) 这场比赛很晚呀 果断滚去睡了 现在来做一下 A CF922 A 翻译: 一开始有一个初始版本的玩具 每次有两种操作: 放一个初始版 ...
- Codeforces Round #461 (Div. 2) B C D
题目链接:http://codeforces.com/contest/922 B. Magic Forest time limit per test 1 second memory limit per ...
- Codeforces Round #461 (Div. 2)
A - Cloning Toys /* 题目大意:给出两种机器,一种能将一种原件copy出额外一种原件和一个附件, 另一种可以把一种附件copy出额外两种附件,给你一个原件, 问能否恰好变出题目要求数 ...
- Codeforces Round #353 (Div. 2) B. Restoring Painting 水题
B. Restoring Painting 题目连接: http://www.codeforces.com/contest/675/problem/B Description Vasya works ...
- Codeforces Round #599 (Div. 1) A. Tile Painting 数论
C. Tile Painting Ujan has been lazy lately, but now has decided to bring his yard to good shape. Fir ...
- Codeforces Round #461 (Div. 2) D. Robot Vacuum Cleaner
D. Robot Vacuum Cleaner time limit per test 1 second memory limit per test 256 megabytes Problem Des ...
- Codeforces Round #461 (Div. 2) B. Magic Forest
B. Magic Forest time limit per test 1 second memory limit per test 256 megabytes Problem Description ...
- Codeforces Round #461 (Div. 2) A. Cloning Toys
A. Cloning Toys time limit per test 1 second memory limit per test 256 megabytes Problem Description ...
- Codeforces Round #461 (Div. 2)B-Magic Forest+位运算或优雅的暴力
Magic Forest 题意:就是在1 ~ n中找三个值,满足三角形的要求,同时三个数的异或运算还要为0: , where denotes the bitwise xor of integers ...
随机推荐
- Quartz.NET实现作业调度(3.0版本实现)定时执行一个任务
2.0版本请参考https://www.cnblogs.com/best/p/7658573.html这里的文章很详细: 我们现在想每5秒钟往txt文件夹里存储一个时间 首先:定义一个类,实现Quar ...
- 查看Apache信息以用户htdoc位置
查看Apache的相关信息:httpd -V 再从基本信息中取得DocumentRoot位置 less /etc/httpd/httpd.conf中查找DocumentRoot,即有静态文件存放的位置 ...
- Android图表库XCL-Charts
首先,这个是国人开发的,支持下必须顶!github项目地址:点击打开,由于项目的基本功能已经实现,所以项目作者也说以后基本不会在有更新了. 项目简介: Android图表库(XCL-Charts is ...
- 面向对象设计与构造:oo课程总结
面向对象设计与构造:OO课程总结 第一部分:UML单元架构设计 第一次作业 UML图 MyUmlInteraction类实现接口方法,ClassUnit和InterfaceUnit管理UML图中的类和 ...
- maven validator数据校验
1.maven文件中添加依赖包 <!-- validator校验--> <dependency> <groupId>org.hibernate</groupI ...
- Spring MVC的高级配置
1.文件上传配置 文件上传是项目中常用的一个功能,Spring MVC通过配置一个MultipartResolver来上传文件. 在Spring的控制器中,通过MultipartFile file 来 ...
- Log4j知识汇总
Log4j在java开发中还是很常见的,而在日志系统里面也占有举足轻重的地位,想要做好日志相关的工作,了解log4j还是很必要的. 下面就针对 log4j的官方文档user-guide 进行翻译与整理 ...
- jquery UI_tabs
1.tab使用 <!doctype html> <html lang="en"> <head> <meta charset="u ...
- Python核心编程——多线程threading和队列
线程与进程类似不过他们是在同一个进程下执行的,并共享相同的上下文.可以将他们认为是在一个主进程或“主线程”中运行的迷你进程. 线程包括开始.执行顺序和结束三部分.它有一个指令指针,用于记录当前运行的上 ...
- java设计模式、框架、架构、平台之间的关系
设计模式<框架<架构<平台,从复用角度讲,设计模式是代码级复用.框架是模块级复用.架构是系统级复用.平台是企业应用级复用. 1.设计模式 为什么要先说设计模式?因为设计模式在 ...