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. LR C语言语句复习,几个简单代码

    嵌套循环 Action() { int i,j; ;i<=;i++) { ) beark; else lr_output_message("i=%d",i); ;j<= ...

  2. Git远程推送文件太大的error解决

    error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errfno 10054 方法1: 改成ssh推送 方法2: 把推送的缓 ...

  3. 基于android-uitableview扩展-uilistview项目

    这个项目是正如标题说的那样,是基于uitableview项目为基础进行二次封装的,目的是实现更多的展现形式,项目地址:点击打开 不过,这个使用起来你还必须得会用uitableview扩展(项目地址:点 ...

  4. springboot 学习笔记(七)

    (七)springboot整合activemq,消息消费,以及发送对象消息 1.springboot整合activemq发送消息,上一节已经介绍了,现在要对消息队列中的内容进行处理,下面写一个cons ...

  5. 解决在eclipse中导入项目名称已存在的有关问题

    新建项目-Import-File System-找到相应的文件夹-Overwrite existing resources without warning打钩,选中项目即可

  6. intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)用法

    如果已经启动了四个Activity:A,B,C和D.在D Activity里,我们要跳到B Activity,同时希望C finish掉,可以在startActivity(intent)里的inten ...

  7. wechat开发笔记之1.接口示例代码

    修改后的php示例代码! <?php /** * wechat php test */ //define your token define("TOKEN", "w ...

  8. office密匙

    office 2010 VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB 6QFDX-PYH2G-PPYFD-C7RJM-BBKQ8 BDD3G-XM7FB-BD2HM-YK63V-VQFD ...

  9. fflush - 刷新一个流

    SYNOPSIS 总览 #include <stdio.h> int fflush(FILE *stream); DESCRIPTION 描述 函数 fflush 强制在所给的输出流或更新 ...

  10. python linecache模块读取文件用法详解

    linecache模块允许从任何文件里得到任何的行,并且使用缓存进行优化,常见的情况是从单个文件读取多行. linecache.getlines(filename) 从名为filename的文件中得到 ...