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 求一个最小的 ...
随机推荐
- sklearn多分类问题
sklearn实战-乳腺癌细胞数据挖掘(博主亲自录制视频) https://study.163.com/course/introduction.htm?courseId=1005269003& ...
- pyppeteer 报错-无法连接到浏览器
问题 程序报错: Failed to connect to browser port: http://127.0.0.1:57899/json/version 原因 虽然pyppeteer在首次启动时 ...
- c# 打印 bartender
参考: 官网 https://www.seagullscientific.com/label-software/barcode-label-design-and-printing 文章 http:/ ...
- java查看本机hostName可代表的ip列表【转】
java查看本机hostName可代表的ip列表 import java.net.InetAddress; public class ent { public static void main(Str ...
- unity引用查找插件-ReferenceFinder
简介 这是一个用来查找资源引用和依赖的插件,通过缓存来保存资源间的引用信息,通过树状结构直观的展示. 由于是通过缓存进行实现的,所以在希望的到精确的引用信息时需要刷新缓存.不过由于缓存的存在, ...
- ObservableData-另一种姿势的观察者模式
使用 数据的定义 public class TestModel { private static TestModel mInstance; public static TestModel GetIns ...
- python执行centos命令
import os improt sys import re import commands a = commands.getoutput("ls -al /") print a
- OSI七层模型与TCP/IP四层模型
OSI七层模型与TCP/IP四层模型 OSI模型(Open System Interconnection Reference Model,缩写为OSI),全名“开放式系统互联通信参考模型”,是一个试图 ...
- Zabbix 监控服务
熟悉了解一些 zabbix 基础项目监控 zabbix_get 相关操作 :获取 item 监控数据 基本格式: -s --host: 指定客户端主机名或者IP -p --port:客户端端口,默认 ...
- Centos 6.5 安装Python 3.7
文档下载地址: https://files.cnblogs.com/files/flashBoxer/Centos6.5%E5%AE%89%E8%A3%85Python3.7.xml