-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEconomy Game
More file actions
25 lines (22 loc) · 722 Bytes
/
Economy Game
File metadata and controls
25 lines (22 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.util.*;
import java.io.*;
public class Main {
static final int MAX = 1000000000;
static final int A = 1234567;
static final int B = 123456;
static final int C = 1234;
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int n = Integer.parseInt(br.readLine());
boolean isAnswer = false;
for (int i = 0; i <= MAX / A; i++)
for (int j = 0; j <= MAX / B; j++)
if ((n - i * A - j * B) >= 0 && (n - i * A - j * B) % C == 0)
isAnswer = true;
if (isAnswer)
System.out.println("YES");
else
System.out.println("NO");
}
}