HzuWHF


私信TA

用户名:I7I08I9047

访问量:76457

签 名:

我RUN了

等  级
排  名 18
经  验 20464
参赛次数 13
文章发表 127
年  龄 3
在职情况 学生
学  校 贺州学院
专  业

  自我简介:

        二分        


参考代码:

#include<bits/stdc++.h>
constexpr auto Inf = 0x3F3F3F3F;
#define Loc freopen("baka.in", "r", stdin)
typedef long long LL;
using namespace std;

const int SIZE = 1E5 + 7;
int Tot, N;
pair<int, int> Arr[SIZE];

bool F(int Mid) {
	int Tmp = 0;
	for (int pos = 1; pos <= Tot; pos++)
		Tmp += (Arr[pos].first / Mid) * (Arr[pos].second / Mid);
	return Tmp >= N;
}

int main() {
	ios::sync_with_stdio(false);
	cin >> Tot >> N;
	for (int pos = 1; pos <= Tot; pos++)
		cin >> Arr[pos].first >> Arr[pos].second;
	int L = 1, R = SIZE, Mid;
	while (L <= R) {
		Mid = (L + R) >> 1;
		F(Mid) ? L = Mid + 1 : R = Mid - 1;
	}
	cout << min(L, R) << endl;
}


 

0.0分

2 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区

为什么SIZE 要为 1E5 + 7,这个有什么含义嘛
2021-04-05 11:31:18
  • «
  • 1
  • »