fork(4) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int n;
  7. cin >> n;
  8. for (int a = 0; a <= n; a += 1234567) {
  9. for (int b = 0; b <= n - a; b += 123456) {
  10. if ((n - a - b) % 1234 == 0) {
  11. cout << "YES";
  12. return 0;
  13. }
  14. }
  15. }
  16. cout << "NO";
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
YES