mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
808996d897
5100-5199
27 lines
621 B
C++
27 lines
621 B
C++
#include <cstdio>
|
|
#include <cstring>
|
|
#include <iostream>
|
|
#include <algorithm>
|
|
#include <cmath>
|
|
#define INF 0x3fffffff
|
|
using namespace std;
|
|
struct node {
|
|
int a, b;
|
|
}dian[105];
|
|
int main() {
|
|
int n, m;
|
|
while(scanf("%d %d", &n, &m) != EOF) {
|
|
for(int i = 0; i < m; i++) {
|
|
scanf("%d %d", &dian[i].a, &dian[i].b);
|
|
}
|
|
int ans = INF;
|
|
for(int i = 0; i<m; i++) {
|
|
int t = n / dian[i].a;
|
|
if(n % dian[i].a) t++;
|
|
if(t * dian[i].b < ans) ans = t * dian[i].b;
|
|
}
|
|
printf("%d\n", ans);
|
|
}
|
|
return 0;
|
|
}
|