File tree 1 file changed +32
-0
lines changed
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ import java .io .*;
2
+ import java .util .*;
3
+
4
+ public class Main {
5
+
6
+ public static final int MAX = 1000000000 ;
7
+
8
+ public static void main (String [] args ) throws IOException {
9
+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
10
+ StringTokenizer st = new StringTokenizer (br .readLine ());
11
+ Long X = Long .parseLong (st .nextToken ());
12
+ Long Y = Long .parseLong (st .nextToken ());
13
+ int Z = (int ) ((Y * 100 ) / X );
14
+ if (Z >= 99 ) {
15
+ System .out .println ("-1" );
16
+ return ;
17
+ }
18
+ int left = 1 ;
19
+ int right = MAX ;
20
+ int answer = right ;
21
+ while (left <= right ) {
22
+ int mid = (left + right ) / 2 ;
23
+ if (((Y + mid ) * 100 / (X + mid )) > Z ) {
24
+ right = mid - 1 ;
25
+ answer = mid ;
26
+ } else {
27
+ left = mid + 1 ;
28
+ }
29
+ }
30
+ System .out .println (answer );
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments