Contest Preparation

Contest Preparation

https://ac.nowcoder.com/acm/contest/34866/B

链接: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 .

凉心哥哥的小宝藏 文章被收录于专栏

c++

全部评论

相关推荐

哇哇的菜鸡oc:他这不叫校招offer,而是实习offer
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务