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++

全部评论

相关推荐

点赞 评论 收藏
分享
06-15 18:44
黄淮学院 Java
Lynn012:如果是居民楼还是算了吧,看着有点野呢
点赞 评论 收藏
分享
05-19 19:57
蚌埠学院 Python
2237:Gpa70不算高,建议只写排名,个人技能不在多而在精,缩到8条以内。项目留一个含金量高的,减少间距弄到一页,硕士简历也就一页,本科不要写很多
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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