标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1029 Accepted Submission(s): 543
#include<iostream> #include<cstdio> #include<cstring> #include <algorithm> #include <math.h> using namespace std; typedef long long LL; int main() { int n,m; while(scanf("%d%d",&n,&m)!=EOF){ int MIN = 999999999; for(int i=1;i<=m;i++){ int a,b; scanf("%d%d",&a,&b); int k = n/a+((n%a==0)?0:1); MIN = min(MIN,b*k); } printf("%d\n",MIN); } return 0; }
标签:
原文地址:http://www.cnblogs.com/liyinggang/p/5701075.html