就是二分暴力就好了

为什么要记下来 呵呵。。。。emm你说为什么。。。

行吧

好吧

我一直以为我的二分出问题了

原来不是 依旧很帅

统计的时候求的减了多少次  然后用次数乘了mid 这样做会使那个人获得的数量大于精确值。。我以为没事来。。还是太天真

#include <bits/stdc++.h>
using namespace std;
const int maxn = , INF = 0x7fffffff;
typedef long long LL;
LL n, k; int main()
{
scanf("%lld", &n);
if(n <= )
{
cout<< <<endl;
return ;
}
LL tmp = n;
LL l = , r = n; while(l <= r)
{
LL sum = ;
tmp = n;
LL mid = l + (r - l) / ;
while(tmp > )
{
LL t = min(mid, tmp);
tmp -= t;
tmp -= tmp / ;
sum += t;
}
if(sum >= (n+) / ) r = mid - ;
else l = mid + ;
}
cout<< l <<endl; return ;
}

Candies CodeForces - 991C(二分水题)的更多相关文章

  1. C - Can you solve this equation? HDU - 2199(二分水题)

    Now,given the equation 8x^4 + 7x^3 + 2x^2 + 3x + 6 == Y,can you find its solution between 0 and 100; ...

  2. codeforces 407 div1 B题(Weird journey)

    codeforces 407 div1 B题(Weird journey) 传送门 题意: 给出一张图,n个点m条路径,一条好的路径定义为只有2条路径经过1次,m-2条路径经过2次,图中存在自环.问满 ...

  3. codeforces 407 div1 A题(Functions again)

    codeforces 407 div1 A题(Functions again) Something happened in Uzhlyandia again... There are riots on ...

  4. CF思维联系– CodeForces - 991C Candies(二分)

    ACM思维题训练集合 After passing a test, Vasya got himself a box of n candies. He decided to eat an equal am ...

  5. Codeforces Round #456 B题

    一.题意 给你一个n和一个k,让你从[1, n]区间内选k个数,这k个数异或和最大. 二.思路 我一开始看到这种题,不自觉地就想到,莫非又要搞很复杂的线段树.主席树?貌似还有些难搞啊.然而事实是:Co ...

  6. Codeforces数据结构(水题)小结

    最近在使用codeblock,所以就先刷一些水题上上手 使用codeblock遇到的问题 1.无法进行编译-------从setting中的编译器设置中配置编译器 2.建立cpp后无法调试------ ...

  7. Educational Codeforces Round 27 补题

    题目链接:http://codeforces.com/contest/845 A. Chess Tourney 水题,排序之后判断第n个元素和n+1个元素是不是想等就可以了. #include < ...

  8. CodeForces 242E二维线段树

                                                                                           E. XOR on Seg ...

  9. Divide Candies CodeForces - 1056B (数学)

    Arkady and his friends love playing checkers on an n×nn×n field. The rows and the columns of the fie ...

随机推荐

  1. Jmeter接口测试(十)测试报告

    这是jmeter接口测试系列的第十篇总结,也是最后一篇,之后会把接口集成的一些内容发一个系列,分享给大家,供大家一起学习进步. 批量执行完接口测试之后,我们需要查看测试报告,在之前单个接口调试我们是通 ...

  2. 【NLP】使用bert

    # 参考 https://blog.csdn.net/luoyexuge/article/details/84939755 小做改动 需要: github上下载bert的代码:https://gith ...

  3. EF多个上下文迁移

    步骤: 1. Enable-Migrations 2. add-migration Initial -ConfigurationTypeName ModelOneDbConfig 3. update- ...

  4. EOS博彩合约设计

    集中博彩游戏合约设计 一.功能接口 1. 质押deposit 由用户发起,用户将个人账户中token质押给平台,从而可以进入平台去参与平台活动. 2. 赎回withdraw 由用户发起,在用户结束平台 ...

  5. ef5 数据库操作

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  6. kali获得windows的shell后乱码

    输入 chcp 65001

  7. Apache 性能配置优化

    前言 最近在进行apache性能优化设置.在修改apache配置)文件之前需要备份原有的配置文件夹conf,这是网站架设的好习惯.以下的apache配置调优均是在red had的环境下进行的. htt ...

  8. [linux] 利用PROMPT_COMMAND实现命令审计

    网上查了实现命令审计大概有以下几种: 查不到了,改天再补充 以下环境基于CentOS 6 1.修改history时间格式 echo 'HISTTIMEFORMAT="%F %T " ...

  9. R语言安装R package的2种方法

    http://www.cnblogs.com/emanlee/archive/2012/12/05/2803606.html

  10. sprint2 (第八天)

    今天课多,没做什么功能.这个sprint定的目标比较高,要实现的功能较多,可能完成不了目标值.因为GitHub下载和上传很慢,经常失败,所以这几天都没有更新GitHub,功能明天早点实现然后上传到Gi ...