A. Factory
 

One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce  (remainder after dividing x by m) more details. Unfortunately, no customer has ever bought any mythical detail, so all the details produced stay on the factory.

The board of directors are worried that the production by the given plan may eventually stop (that means that there will be а moment when the current number of details on the factory is divisible by m).

Given the number of details a on the first day and number m check if the production stops at some moment.

Input

The first line contains two integers a and m (1 ≤ a, m ≤ 105).

Output

Print "Yes" (without quotes) if the production will eventually stop, otherwise print "No".

Sample test(s)
input
1 5
output
No
input
3 6
output
Yes

开始做时,一直没理解那个取模是怎么回事,

 #include <iostream>
using namespace std; int main()
{
long long a, m;
bool flag = false;
while(cin >> a >> m)
{
for(int i=; i<=; i++, a = a + (a%m)) ///a的这句话就是题意
if(a % m == )
flag = ; cout << (flag ? "Yes" : "No") << endl;
} return ;
}

最新文章

  1. [LeetCode] Self Crossing 自交
  2. JavaScript闭包深入解析
  3. Xcode7 Cocoapods 安装或更新出现错误
  4. 练习使用markdown编辑
  5. JavaScript Patterns 6.3 Klass
  6. C#-WinForm-如何获取文本框(TextBox)中鼠标,光标位置
  7. git merge和个git rebase的区别
  8. java调用Http请求 -HttpURLConnection学习
  9. luigi学习3-使用luigid
  10. C++中输入输出流及文件流操作笔记
  11. BZOJ 1770: [Usaco2009 Nov]lights 燈( 高斯消元 )
  12. SpringMVC类型转换、数据绑定
  13. 浅谈 Requests包
  14. sql server 2000的安装
  15. 【实验吧】CTF_Web_简单的SQL注入之3
  16. SQL Server用户自定义数据类型
  17. Oracle 查看链接数、创建索引等的DDL语句
  18. kmeans聚类理论篇
  19. 三、Docker网络
  20. a标签和p标签不能设置margin

热门文章

  1. Web 项目下载图片简单处理方式
  2. iOS 短信分享 邮件分享
  3. Struts2拦截器之ModelDrivenInterceptor
  4. 1.4 算法 - algorithm
  5. Android之IPC机制
  6. Clr Via C#读书笔记---计算限制的异步操作
  7. Overview and Evaluation of Bluetooth Low Energy: An Emerging Low-Power Wireless Technology
  8. 【JAVA IO流之字符流】
  9. git branch用法总结
  10. Python科学计算发行版—Anaconda