#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1e5 + 5;
int n, h;
struct Knife {
int damage, num;
bool operator<(const Knife& b) const {
return damage > b.damage;
}
} a[N];
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> n >> h;
int tot = 0;
for (int i = 1; i <= n; i++) {
cin >> a[tot].damage; a[tot++].num = 0;
cin >> a[tot].damage; a[tot++].num = 1;
}
int res = 0;
sort(a, a + tot);
for (int i = 0; i < tot; i++) {
if (a[i].num) {
h -= a[i].damage;
res++;
if (h <= 0) {
cout << res << endl;
return 0;
}
} else {
if (h % a[i].damage == 0) res += (h / a[i].damage);
else res += (h / a[i].damage + 1);
cout << res << endl;
return 0;
}
}
return 0;
}
样例都过了