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.


解题心得:

  1. 题意就是用n分别mod1….k,余数是否会出现重复的。
  2. 看到数据量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的更多相关文章

  1. CF922 CodeForces Round #461(Div.2)

    CF922 CodeForces Round #461(Div.2) 这场比赛很晚呀 果断滚去睡了 现在来做一下 A CF922 A 翻译: 一开始有一个初始版本的玩具 每次有两种操作: 放一个初始版 ...

  2. 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 ...

  3. Codeforces Round #461 (Div. 2)

    A - Cloning Toys /* 题目大意:给出两种机器,一种能将一种原件copy出额外一种原件和一个附件, 另一种可以把一种附件copy出额外两种附件,给你一个原件, 问能否恰好变出题目要求数 ...

  4. Codeforces Round #353 (Div. 2) B. Restoring Painting 水题

    B. Restoring Painting 题目连接: http://www.codeforces.com/contest/675/problem/B Description Vasya works ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. Codeforces Round #461 (Div. 2)B-Magic Forest+位运算或优雅的暴力

    Magic Forest 题意:就是在1 ~ n中找三个值,满足三角形的要求,同时三个数的异或运算还要为0: , where  denotes the bitwise xor of integers  ...

随机推荐

  1. 使用Pycharm开发python下django框架项目生成的文件解释

    目录MyDjangoProject下表示工程的全局配置,分别为setttings.py.urls.py和wsgi.py,1.其中setttings.py包括了系统的数据库配置.应用配置和其他配置,2. ...

  2. [备忘]java 静态块、非静态块、静态函数、构造函数 执行顺序

    原文链接:http://liqita.iteye.com/blog/1472717 java中经常有一些静态块,这是用来在生成类之前进行的初始化,无论java还C++语言中的static,都是最先初始 ...

  3. js重载的实现

    在JavaScript高级程序设计书中看到 ECMAScript函数中不能想传统意义上那样实现重载.而在其他语句中(Java)中,可以为一个函数编写两个定义,只要两个定义的签名(接受的参 数的类型和数 ...

  4. /etc/syslog.conf日志配置文件详解

    //将info或更高级别的消息送到/var/log/messages,除了mail以外. //其中*是通配符,代表任何设备:none表示不对任何级别的信息进行记录. *.info;mail.none; ...

  5. 微软AI发布会,集齐六大亮点召唤黑科技!

    7月12日,微软合作伙伴大会Inspire在华盛顿特区如火如荼地举行.同一天,在相隔5个时区的伦敦,微软还举办了一场关于人工智能的发布会.这是一场智能技术和情感体验两相交融的科技盛宴,既有黑科技,也有 ...

  6. System Center Configuration Manager 2016 域准备篇(Part4)

    步骤4.创建系统管理容器 注意:在Active Directory域控制器服务器(AD01)上以本地管理员身份执行以下操作 有关您为何这样做的详细信息,请参阅https://docs.microsof ...

  7. Hyper-V 2016 配置管理系列(部署篇)

    Hyper主机前提准备以后,我们开始Hyper-V Cluster 群集配置 准备验证Cluster 群集 : 1)打开群集管理器,点击"validate Configuration&quo ...

  8. 怎样在github里面写个人主页

    1 登录你的账号 打开

  9. 比特币中P2SH(pay-to-script-hash)多重签名的锁定脚本和解锁脚本

    P2SH(pay-to-script-hash)多重签名的脚本 P2SH是多重签名的一种应用形式.在P2SH的交易中,多了一个Redeem Script的概念,称为赎回脚本.当向P2SH脚本的地址转账 ...

  10. 可以让表格变为拖动边界调整列宽度的JS办法

    需要引入文件: jquery.resizableColumns.min.js 和 jquery.resizableColumns.css 代码如下: $(".tableclass" ...