Codeforces round 1103
Div1 534
- 我可能还太菜了.jpg
- 果然我只是Div 2 选手
A
(这题是Div1吗...
直接构造:竖着放的在第一行和第二行,然后横着放的时候直接放在第三行就行。
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
using namespace std;
#define N 1005
char s[N];int n;
int main()
{
scanf("%s",s+1);n=strlen(s+1);
for(int i=1,now1=0,now2=0;i<=n;i++)
{
if(s[i]=='1')
{
if(now1)printf("1 3\n");
else printf("1 1\n");
now1^=1;
}else
{
printf("%d %d\n",3,now2+1);
now2++;now2%=4;
}
}
}
B
看到$60$就知道是二分或者倍增...
然后发现,正解是二分+倍增...
首先,我们知道,如果$a$在$2^k\sim 2{k+1}$之间,那么,在询问$2{k-1},2^k$的时候,可以知道一定是后者大于前者...
所以在询问$2{k-i-1},s{k-i}$的时候同样...
而在询问$2^{k}, 2^{k+1}$的时候,一定是前者大于等于后者。
所以就可以二分出来一个位置$x$,满足$x\mod a<2^{k+1}\mod a$
然后就行了.jpg
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
using namespace std;
char s[15];
int cnt=0;
bool ask(int x,int y)
{
cnt++;
printf("? %d %d\n",x,y);
fflush(stdout);
scanf("%s",s);
if(s[0]=='x')return 1;
else return 0;
}
int main()
{
while(1)
{
scanf("%s",s);cnt=0;
if(s[0]=='e'||s[0]=='m')return 0;
int i;
for(i=1;i<=1000000000;i<<=1)if(ask(i,i<<1))break;
int l=i,r=i<<1,ans=-1;
while(l<=r)
{
int m=(l+r)>>1;
if(ask(m,i<<1))l=m+1;
else r=m-1,ans=m;
}
if(ans!=-1)printf("! %d\n",ans);
else
{
if(ask(i<<1,i))printf("! %d\n",i);
else printf("! %d\n",i<<1);
}
fflush(stdout);
}
}
C
暂时还不会...
D
先求一个$\gcd$,然后排个序,显然最多只会打$\gcd$的质因子个数次
然后显然对于所以的质因子,做一个状压DP即可...
Codeforces round 1103的更多相关文章
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- Codeforces Round #279 (Div. 2) ABCDE
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name A Team Olympiad standard input/outpu ...
- Codeforces Round #262 (Div. 2) 1003
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...
- Codeforces Round #262 (Div. 2) 1004
Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory lim ...
- Codeforces Round #370 - #379 (Div. 2)
题意: 思路: Codeforces Round #370(Solved: 4 out of 5) A - Memory and Crow 题意:有一个序列,然后对每一个进行ai = bi - bi ...
- Codeforces Round #371 (Div. 1)
A: 题目大意: 在一个multiset中要求支持3种操作: 1.增加一个数 2.删去一个数 3.给出一个01序列,问multiset中有多少这样的数,把它的十进制表示中的奇数改成1,偶数改成0后和给 ...
随机推荐
- TNS-12549问题分析及解决办法
该服务器启动监听时候报错因为最后一句是Linux Error:No space left on device 因为是LINUX Error,所以可以到/var/log/messages里查看具体报错信 ...
- 语义slam用于高精地图和高精定位的一些想法
最近一直在考虑语义slam在自动驾驶和辅助驾驶中的用法,研究了一下视觉为主的高精度地图+高精定位的模式,特别是mobileye的REM. 秉承先建图再定位的思路,在服务器端(云端)建图,在车端定位. ...
- 数据库小组与UI小组第一次对接
时间:2018.6.1,21:30 ~ 23:00 人员:除黄志鹏外全体成员,因为黄志鹏临时有事 工作内容: 主要为数据库小组与UI第二组对接,并将成果汇总到github仓库.另外UI第一组重构了代码 ...
- kafka入门1:安装及配置
1下载 官方下载地址:https://kafka.apache.org/downloads 案例使用版本:kafka_2.11-1.1.0.tgz 2上传服务器 使用ftp工具将压缩包放置到服务器上 ...
- 将 Windows VM 移到其他 Azure 订阅或资源组
本文逐步说明如何在资源组或订阅之间移动 Windows VM. 如果最初在个人订阅中创建了 VM,现在想要将其移到公司的订阅以继续工作,则在订阅之间移动 VM 可能很方便. Important 不可在 ...
- 解决VB6.0中不能加载MSCOMCTL.OCX的错误提示
VB6.0毕竟是很古老的开发工具了,其对所使用的第三方组件依赖性比较强,例如在打开从其它电脑上拿来的VB6.0的软件(系统)的工程文件(源代码)时,经常会遇到"不能加载MSCOMCTL.OC ...
- eclipse在server中tomcat server找不到的问题
想要在eclipse的server新建tomcat服务器然而不知道怎么回事找不到Tomcat 7.0 Server 下面的红圈是tomcat server服务器(更新后才出现) 网上找的很久,只是找到 ...
- 安装SQL sever2008时显示重新启动计算机规则失败,应该怎么解决?
1.删除注册表:在HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager中找到 PendingFileRenameOpe ...
- zabbix待完整
fad 下载zabbix3.4的配置文件 wget -O zabbix-3.4.2.tar.gz http://sourceforge.net/projects/zabbix/files/ZABBIX ...
- win7X64位安装mysql-5.7.16
今天尝试在win7系统中安装mysql,发现过程有点复杂,不过还好已经成功安装,写个博客纪念一下,顺便可以帮助大家. 1.在官网上面下载mysql, 注意:一定要下载对应的版本,第一次下载的是最下面一 ...