codeforces-scrape

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

681B.md (1637B)


      1 Source: https://codeforces.com/problemset/problem/681/B
      2 
      3 B. Economy Game
      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 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Kolya is developing an economy simulator game. His most favourite part of the development process is in-game testing. Once he was entertained by the testing so much, that he found out his game-coin score become equal to 0.
     22 
     23 Kolya remembers that at the beginning of the game his game-coin score was equal to *n* and that he have bought only some houses (for 1 234 567 game-coins each), cars (for 123 456 game-coins each) and computers (for 1 234 game-coins each).
     24 
     25 Kolya is now interested, whether he could have spent all of his initial *n* game-coins buying only houses, cars and computers or there is a bug in the game. Formally, is there a triple of non-negative integers *a*, *b* and *c* such that *a* × 1 234 567 + *b* × 123 456 + *c* × 1 234 = *n*?
     26 
     27 Please help Kolya answer this question.
     28 
     29 Input
     30 
     31 The first line of the input contains a single integer *n* (1 ≤ *n* ≤ 109) — Kolya's initial game-coin score.
     32 
     33 Output
     34 
     35 Print "YES" (without quotes) if it's possible that Kolya spent all of his initial *n* coins buying only houses, cars and computers. Otherwise print "NO" (without quotes).
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 1359257
     43 ```
     44 
     45 Output
     46 
     47 ```
     48 YES
     49 ```
     50 
     51 Input
     52 
     53 ```
     54 17851817
     55 ```
     56 
     57 Output
     58 
     59 ```
     60 NO
     61 ```
     62 
     63 Note
     64 
     65 In the first sample, one of the possible solutions is to buy one house, one car and one computer, spending 1 234 567 + 123 456 + 1234 = 1 359 257 game-coins in total.