??? 代码AC 样例过不了 带注释求调

P1843 奶牛晒衣服

。。。你这代码太假了
by huangjunxi0822 @ 2022-09-14 00:30:47


# 咳咳 现在我们来回复一下dalao:YORG 的帖子 首先~~上代码~~ ``` #include<bits/stdc++.h> using namespace std; //题中数据 int n,a,b; //湿度 int w[500020]; //二分数据 int Left,Right,mid; //二分检查 bool check(int ans) { //替换 int inw[500020]; //需要的烘烤时长 int num=0; for(int i=1;i<=n;i++) { inw[i]=w[i]; inw[i]-=a*ans; } /*for(int i=1;i<=n;i++) { cout<<inw[i]<<" "; } cout<<endl;*/ for(int i=1;i<=n;i++) { if(inw[i]>0) { num+=inw[i]/b; if(inw[i]%b!=0) { num++; } } if(num>ans) return false; } return true; } int main() { //读入 cin>>n>>a>>b; for(int i=1;i<=n;i++) { cin>>w[i]; Right=max(Right,w[i]); } //初始化二分数据 Left=0; //二分 while(Left+1<Right) { mid=(Left+Right)>>1; if(check(mid)) { Right=mid; } else { Left=mid; } } cout<<Right<<endl; return 0; } ``` Yorg能看出来吗 ~~(Left初始化为0!!!)~~ [测试点](https://www.luogu.com.cn/record/86576185) (样例过了) 你问为什么? 嗯...... ``` you问I I问who ``` ~~不过我相信dalao Yorg一定能懂吧(自信)~~
by huangjunxi0822 @ 2022-09-14 00:48:08


|