分巧克力
本文最后更新于 1831 天前,其中的信息可能已经有所发展或是发生改变。
#include<iostream>
using namespace std;
int arr[100005][2];
int n,k;
bool judge(int m){
	int count=0;
	for(int i=0;i<n;i++){
		count+=((arr[i][0]/m)*(arr[i][1]/m));
		if(count>=k){
			return true;
		}
	}
	return false;
}
int main(){
	int MAX=0,MIN=1;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>arr[i][0]>>arr[i][1];
		if(arr[i][0]>MAX){
			MAX=arr[i][0];
		}
		if(arr[i][1]>MAX){
			MAX=arr[i][1];
		}
	}
	MAX++;	
	while(MAX-MIN>1){
		cout<<"MAX"<<MAX<<"MIN"<<MIN<<endl;
		int MID=(MAX+MIN)/2;
		if(judge(MID)){
			MIN=MID;
		}else{
			MAX=MID;
		}
		cout<<"+-----MAX"<<MAX<<"MIN"<<MIN<<endl;
	}
	cout<<MIN;
	return 0;
} 
作者:Yuyy
博客:https://yuyy.info
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇