标签:
10 3 15 12 15 4 7 12
13
1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long LL; 4 LL n,m,u,d,ret; 5 void check() { 6 LL tmp = (n*d+u+d)/(u+d); 7 ret = min(ret,(u+d)*tmp - n*d); 8 } 9 int main() { 10 ios::sync_with_stdio(false); 11 cin>>n>>m; 12 ret = INT_MAX; 13 while(m--) { 14 cin>>u>>d; 15 check(); 16 } 17 cout<<ret<<endl; 18 return 0; 19 }
标签:
原文地址:http://www.cnblogs.com/crackpotisback/p/4624109.html