-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1072.cpp
More file actions
43 lines (37 loc) · 816 Bytes
/
1072.cpp
File metadata and controls
43 lines (37 loc) · 816 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
36
37
38
39
40
41
42
43
#include <vector>
#include <iostream>
#include <queue>
using namespace std;
int main(int argc, char** argv)
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long x;
long long y;
long long z;
while(true){
cin>>x>>y;
if(cin.eof()==true) break;
z = (y*100)/x;
long long high = 2000000000;
long long low = 1;
int ans = -1;
while(low<=high)
{
long long mid = (high+low)/2;
long long tmp = ((y+mid)*100)/(x+mid);
if(tmp==z)
{
low = mid + 1;
}
else
{
high = mid - 1;
if(ans==-1||ans>mid) ans = mid;
}
}
cout<<ans<<"\n";
}
return 0;
}