-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask625A.java
More file actions
35 lines (33 loc) · 831 Bytes
/
Task625A.java
File metadata and controls
35 lines (33 loc) · 831 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
26
27
28
29
30
31
32
33
34
35
import java.util.*;
public class Task625A {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
long a, b, c, n;
n = s.nextLong();
a = s.nextLong();
b = s.nextLong();
c = s.nextLong();
if (a <= b - c) {
System.out.println(n / a);
return;
} else if(n - b < 0) {
System.out.println(n / a);
return;
}
long l = (n - b) / (b - c) + 1;
n -= l * (b - c);
if( n / a > 0)
l += n / a;
System.out.println(l);
/* long l = 0;
while(n / b > 0) {
long cl = n / b;
n -= cl* (b - c);
l += cl;
}
if (n / a > 0)
l += n / a;
System.out.println(l);
*/
}
}