codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

485A.md (1264B)


      1 Source: https://codeforces.com/problemset/problem/485/A
      2 
      3 A. Factory
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 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 ![](https://espresso.codeforces.com/4085628a7f3a4ad1ec3a2d67435e8a7ce3eb797d.png) (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.
     22 
     23 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*).
     24 
     25 Given the number of details *a* on the first day and number *m* check if the production stops at some moment.
     26 
     27 Input
     28 
     29 The first line contains two integers *a* and *m* (1 ≤ *a*, *m* ≤ 105).
     30 
     31 Output
     32 
     33 Print "Yes" (without quotes) if the production will eventually stop, otherwise print "No".
     34 
     35 Examples
     36 
     37 Input
     38 
     39 ```
     40 1 5
     41 ```
     42 
     43 Output
     44 
     45 ```
     46 No
     47 ```
     48 
     49 Input
     50 
     51 ```
     52 3 6
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 Yes
     59 ```