3 条题解
-
0
//freopen("kuohao.in","r",stdin); // freopen("kuohao.out","w",stdout); //二分答案 //往前走,如果距离不足就不走,看下一个距离够不够 #include<bits/stdc++.h> using namespace std; int len,n,m; int a[50002]; bool duoshao(int x)//当距离为x时,搬的石头少不少 { int p=0,count=0;//p为当前位置,count统计需要搬走多少 for(int i=1;i<=n+1;i++) { if(a[i]-a[p]>=x)p=i; else count++; } if(m>=count)return 1; else return 0;//多了 }
信息
- ID
- 642
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 10
- 标签
- 递交数
- 2
- 已通过
- 2
- 上传者