CF485A.Factory

普及/提高-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

一家工业企业正在改革其工作计划。厂长建议设定一种“神话零件”的生产定额:若某天开始时工厂仓库中有 xx 个零件,则到当天结束时,工厂必须额外生产 x mod m\displaystyle x \bmod m(即 xx 除以 mm 的余数)个零件。不幸的是,从未有客户购买过任何“神话零件”,因此所有生产的零件都保留在工厂内。

董事会担心,按该计划进行生产最终可能会停止(即某一时刻工厂中零件的当前数量恰好能被 mm 整除)。

给定第一天开始时的零件数量 aa 和整数 mm,请判断生产是否会在某个时刻停止。

输入格式

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

第一行包含两个整数 aa 和 mm(1 ≤ a, m ≤ 1051 ≤ a, m ≤ 10^5)。

输出格式

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

如果该生产过程最终会停止,则输出“Yes”(不带引号),否则输出“No”。

输入输出样例

  • 输入#1

    1 5

    输出#1

    No
  • 输入#2

    3 6

    输出#2

    Yes

输入解题思路,AI测评打分。不知道怎么写?

首页