链接:https://ac.nowcoder.com/acm/contest/34866/B 来源:牛客网
Walk_alone is anxious to prepare for a programming contest, and he has ideas for nn problems now. Preparing a problem from scratch requires two jobs: making and validating. He asked mm people to help him with these two jobs.
All these mm people are skilled at making and validating problems, and each person needs exactly 11 hour to do one of these two jobs. A job should be done by only one person without interruption (but making and validating one problem can be done by two different people), and a problem must be made before validated. Now Walk_alone wants to know the minimum hours to prepare for the contest if he arranges everyone's job properly.
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 50;
typedef long long ll;
string str[55];
int main() {
int t;
cin >> t;
while (t--) {
ll n, m;
cin >> n >> m;
if (n == 0) {
cout << 0 << endl;
continue;
}
if (n > 0 && n <= m) {
cout << 2 << endl;
continue;
}
if (n > m) {
cout << (n*2 +m - 1)/m<<endl ;
continue ;
}
}
return 0;
}
A problem which is easy Fractional expression .