CodeForces 689C【二分】】的更多相关文章

C. Mike and Chocolate Thieves time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Bad news came to Mike's village, some thieves stole a bunch of chocolates from the local factory! Horrible! As…
原题: Description Bad news came to Mike's village, some thieves stole a bunch of chocolates from the local factory! Horrible! Aside from loving sweet things, thieves from this area are known to be very greedy. So after a thief takes his number of choco…
Mike and Chocolate Thieves 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/G Description Bad news came to Mike's village, some thieves stole a bunch of chocolates from the local factory! Horrible! Aside from loving sweet things, thieves fr…
题目并不难,就是比赛的时候没敢去二分,也算是一个告诫,应该敢于思考…… #include<stdio.h> #include<iostream> using namespace std; int main() { long long n; scanf("%I64d",&n); ,right=1e18,mid,num,m,s; ; while(left<=right) { mid=(left+right)>>; num = ; ;i &l…
题目链接: C. Mike and Chocolate Thieves time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Bad news came to Mike's village, some thieves stole a bunch of chocolates from the local factory! Horrib…
转自: http://blog.csdn.net/qq_26071477/article/details/51892995 #include<stdio.h> typedef long long ll; ll check(ll n) { ll res=0; for(ll k=2; k*k*k<=n; k++)//k是ll范围 不可犯糊涂 res+=n/(k*k*k); return res; } int main() { ll m,res=-1,l=1,r=1e18,mid; scanf…
题目:CodeForces - 363D 题意:给定n个学生,其中每个学生都有各自的私己钱,并且自己的私己钱只能用在自己买自行车,不能给别人. 给定m个自行车,每个自行车都有一个价格. 给定公有财产a.    然后求出这些学生能买自行车的最大数量,并且求当买下最大自行车数量时,总体花费私己钱的最少的钱. 我先来说以下二分搜索模板: //右值点不能取到的情况 int binary_search(vector<int>& nums,int left,int right, int targe…
n people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his maximum speed. You can put a bomb in some point with non-n…
/* 不要低头,不要放弃,不要气馁,不要慌张 题意: n天进行m科考试,每科考试需要a的复习时间,n天每天最多可以考一科.并且指定哪天考哪科. 注意考试那天不能复习. 问最少需要多少天可全部通过考试. 思路: 转化为判定性问题.二分天数. 然后贪心,在规定天数以内,最后一天通过即可.需要保证每一科最后一天之前剩下还没考试的科目都来得及复习.(同时注意要要加上考试时间) 最后还要判定是不是所有的科目都通过了. */ #include<bits/stdc++.h> using namespace…
上学期刷过裸的RMQ模板题,不过那时候一直不理解>_< 其实RMQ很简单: 设f[i][j]表示从i开始的,长度为2^j的一段元素中的最小值or最大值 那么f[i][j]=min/max{d[i][j-1], d[i+2^j-1][j-1]} RMQ的ST算法: void ST() //初始化 { memset(RMQ,,sizeof(RMQ)); ;i<=n;i++) RMQ[i][]=a[i]; ;(<<j)<=n;j++) ;i+(<<j)-<=…