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的更多相关文章

  1. 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 ...

  2. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

  3. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

  4. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

  5. Codeforces Round #279 (Div. 2) ABCDE

    Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/outpu ...

  6. 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 ...

  7. 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 ...

  8. Codeforces Round #370 - #379 (Div. 2)

    题意: 思路: Codeforces Round #370(Solved: 4 out of 5) A - Memory and Crow 题意:有一个序列,然后对每一个进行ai = bi - bi  ...

  9. Codeforces Round #371 (Div. 1)

    A: 题目大意: 在一个multiset中要求支持3种操作: 1.增加一个数 2.删去一个数 3.给出一个01序列,问multiset中有多少这样的数,把它的十进制表示中的奇数改成1,偶数改成0后和给 ...

随机推荐

  1. ionic 项目内部更新用到的插件,退出app插件

    一 cordova-plugin-app-version插件  用来获取APP版本 ionic plugin add cordova-plugin-app-version -----cordova-p ...

  2. 葡萄城报表 SP2 新特性(1)— 单元格智能合并

    中国式复杂报表的布局,因为数据的动态性和结构性,导致其布局往往是无规律,且在设计时无法预测的,如单元格合并,通常不仅希望在每一列的数据展现中,能够根据需要自动将相同的单元格合并,且每个单元格之间该属性 ...

  3. Python笔记(六):推导数据

    (一)  准备工作 创建1个文件记录运动员的跑步成绩 james.txt 2-34,3:21,2.34,2.45,3.01,2:01,2:01,3:10,2-22 (二)  要求 在屏幕上输出运动员最 ...

  4. docker in all

    docker vs hyper-v,vmware,xen,kvm docker host, docker container, docker engineen, docker image images ...

  5. 使用TaskScheduler 调度器 实现跨线程的控件访问

    //任务调度器 TaskScheduler UIscheduler = null; public Form1() { //获取任务调度器 UIscheduler = TaskScheduler.Fro ...

  6. round()和trunc()用法

    round(数字 | 列 保留小数的位数):四舍五入. select a.*,round(s),round(-s) from bqh4 a trunc(数字 | 列 保留小数的位数):舍弃指定位置的内 ...

  7. python web编程CGI

    CGI(通用网关接口),CGI 是Web 服务器运行时外部程序的规范,按CGI 编写的程序可以扩展服务器功能. CGI 应用程序能与浏览器进行交互,还可通过数据库API 与数据库服务器等外部数据源进行 ...

  8. ISO8583组包、解包

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace POS. ...

  9. Docker容器学习与分享03

    Docker容器的基本操作 所有的docker命令都是以docker开头,也就是指调用docker程序.我学习的第一个命令就是docker run,运行一个容器.以Docker分享02中的容器为例: ...

  10. 2018.08.31 16:26 调试 Swift 和 Pycharm 与 github 之间的链接

    花了一段时间调试Swift和Pycharm的链接,网上查了一下有关信息,再加上自己的摸索,一会就掌握了.