cf1104d二分+数学
#include<bits/stdc++.h>
using namespace std; bool ask(int x,int y){
printf("? %d %d\n",x,y);
fflush(stdout);
char buf[];
scanf("%s",buf);
return buf[]=='x';
} int work(){
if(ask(,))return ;
int l=,r,ans,mid;
while(ask(l*,l))l*=;
r=l*+,r=min(r,);
while(l<=r){
mid=l+r>>;
if(ask(mid,(mid+)/))//mid小于猜的数
l=mid+;
else ans=mid,r=mid-;
}
return ans; } int main(){
char cmd[];
while(){
scanf("%s",cmd);
if(strcmp(cmd,"start")==){
printf("! %d\n",work());
fflush(stdout);
}
else break;
}
}
cf1104d二分+数学的更多相关文章
- LightOj1137 - Expanding Rods(二分+数学)
题目链接:http://lightoj.com/volume_showproblem.php?problem=1137 题意:有一根绳子的长度为l,在有温度的情况下会变形为一个圆弧,长度为 l1 = ...
- Codeforces Gym 100425A Luggage Distribution 二分 数学
A - Luggage DistributionTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/c ...
- POJ 1759 Garland(二分+数学递归+坑精度)
POJ 1759 Garland 这个题wa了27次,忘了用一个数来储存f[n-1],每次由于二分都会改变f[n-1]的值,得到的有的值不精确,直接输出f[n-1]肯定有问题. 这个题用c++交可以 ...
- Codeforces Round #514 (Div. 2):D. Nature Reserve(二分+数学)
D. Nature Reserve 题目链接:https://codeforces.com/contest/1059/problem/D 题意: 在二维坐标平面上给出n个数的点,现在要求一个圆,能够容 ...
- Manthan, Codefest 16 E. Startup Funding ST表 二分 数学
E. Startup Funding 题目连接: http://codeforces.com/contest/633/problem/E Description An e-commerce start ...
- Manthan, Codefest 16 B. A Trivial Problem 二分 数学
B. A Trivial Problem 题目连接: http://www.codeforces.com/contest/633/problem/B Description Mr. Santa ask ...
- CDOJ 1277 智商杯考试 每周一题 div2 二分+数学
智商杯考试 题目连接: http://acm.uestc.edu.cn/#/problem/show/1277 Description 你是一个挂科选手. 你现在正在考试,你很方. 你参加的考试叫做智 ...
- Codeforces Round #127 (Div. 1) E. Thoroughly Bureaucratic Organization 二分 数学
E. Thoroughly Bureaucratic Organization 题目连接: http://www.codeforces.com/contest/201/problem/E Descri ...
- URAL 1948 H - The Robot on the Line 二分 + 数学
http://acm.hust.edu.cn/vjudge/contest/126149#problem/H 给定一条二次函数 f (x) = a * x * x + b * x + c 求一个最小的 ...
随机推荐
- bzoj千题计划302:bzoj3160: 万径人踪灭
https://www.lydsy.com/JudgeOnline/problem.php?id=3160 不连续的回文串数量=所有的回文序列数量-连续的回文子串 连续的回文子串: manacher ...
- 转 -- pydoc用法
原文地址: https://www.cnblogs.com/meitian/p/6704488.html pydoc用法 pydoc是python自带的一个文档生成工具,使用pydoc可以很方便的查看 ...
- 06-开闭原则(OCP)
1. 背景 在软件的生命周期内,因为变化.升级和维护等原因需要对软件原有代码进行修改时,可能会给旧代码中引入错误,也可能会使我们不得不对整个功能进行重构,并且需要原有代码经过重新测试. 2. 定义 ...
- Css3实现常用的几种loading动画
css实现loading动画非常方便,也非常实用 第一种 <!DOCTYPE html> <html lang="en"> <head> < ...
- div背景半透明
例子: html: <div class="erp-mask-a" > <div class="erp-mask-cell-a"> he ...
- POJ2031 Building a Space Station【最小生成树】
题意: 就是给出三维坐标系上的一些球的球心坐标和其半径,搭建通路,使得他们能够相互连通.如果两个球有重叠的部分则算为已连通,无需再搭桥.求搭建通路的最小边长总和是多少. 思路: 先处理空间点之间的距离 ...
- _vimrc(VimScript脚本语言学习)
Windows下 syntax on "高亮 "缩进 set cindent "set cin set smartindent "set si set auto ...
- 阿里云服务器 ECS Linux 禁止IP 通过 SSH 登录
这几天买的服务器老是受到黑客攻击被破解登录密码,今天修改了登录规则发现只有固定ip可以访问,其他ip即使有密码也无法登录我的服务器,但是能通过ip访问我的网站,哈哈. 限制 IP SSH 登录解决步骤 ...
- django学习~models之查询
一 简介:今天学习models查询的一些东西 二 理解概念 Queryset 定义 从数据库中查询出来的结果一般是一个集合,这个集合叫做 QuerySet 三 细节学习 一 常用的models函数 . ...
- MoveIt! 源安装
rosdep update sudo apt-get update sudo apt-get dist-upgrade sudo apt-get install python-wstool pytho ...