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. UICollectionView基础API笔记

    UICollectionView系列API,属性含义笔记.在UICollectionView笔记1中我们了解了UICollectionView是什么,以及可以做什么:在UICollectionView ...

  2. ifream页面弹出框遮盖层覆盖父页面

    1.首先找到子页面上遮罩层的id, 2.然后再父页面编写个js方法 function shade() { $(".layui-layer-shade").height($(wind ...

  3. 创作了一个xml的替代格式

    xml格式: <?xml version="1.0" encoding="GB2312"?> <Relations> <Relat ...

  4. Android 浮动按钮的伸缩效果

    在做项目时想增加点动感,于是就有如下效果: 实现起来也很简单,通过属性动画和recyclerview 滑动结合就很好实现了. 通过给recycleview添加一个滑动监听:通过滚动的差值来处理动画 m ...

  5. oracle 11g r2卸载

    1. 进入计算机管理>>服务里,停止所有oracle的服务 2. 开始菜单>>程序>>Oracle>>Oracle安装产品>>Univers ...

  6. 梦织未来Windows驱动编程 第04课 驱动相关的数据结构

  7. linux 命令——33 df(转)

    linux中df命令的功能是用来检查linux服务器的文件系统的磁盘空间占用情况.可以利用该命令来获取硬盘被占用了多少空间,目前还剩下多少空间等信息. 1.命令格式: df [选项] [文件] 2.命 ...

  8. IOS autosizing(设置控件的固定位置大小)

    - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typica ...

  9. hdu1213-How Many Tables---基础并查集

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1213 题目大意: 今天是Ignatius的生日,他邀请了许多朋友.现在是吃晚饭的时间,Ignatiu ...

  10. bzoj4622 [NOI 2003] 智破连环阵

    Description B国在耗资百亿元之后终于研究出了新式武器——连环阵(Zenith Protected Linked Hybrid Zone).传说中,连环阵是一种永不停滞的自发性智能武器.但经 ...