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

全部评论

相关推荐

09-19 13:59
门头沟学院 Java
用微笑面对困难:Trae一下,如果真成了,他用了直接发字节起诉代码版权,,这个代码不商用是没问题的如果没成也是情理之中的。
点赞 评论 收藏
分享
09-01 11:31
门头沟学院 Java
buul:七牛云的吧,感觉想法是好的,但是大家没那么多时间弄他这个啊。。。不知道的还以为他是顶尖大厂呢还搞比赛抢hc,只能说应试者的痛苦考察方是无法理解的,他们只会想一出是一出
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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