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. JS中String与Array的一些常用方法

    真是恨透了这些类似于substring substr slice 要么长得像,要么就功能相近的方法... 1⃣️string 1.substring(start开始位置的索引,end结束位置索引) 截 ...

  2. AngularJS学习之 ui router

    1.安装 bower install --save angular_ui-router 2.在项目主页面 index.html中添加 <div ui-view="">& ...

  3. JMeter4.0的界面汉化

    1.安装好之后 2.界面汉化 options->choose language->chinese(simplified) 3.汉化完成

  4. CSS 小结笔记之变形、过渡与动画

    1.过渡 transition  过渡属性用法: transition :ransition-property  transition-duration  transition-timing-func ...

  5. oracle数据库occi接口写入中文乱码解决方法

    将初始化代码中 Environment::createEnvironment(Environment::DEFAULT); 改为 Environment::createEnvironment(“UTF ...

  6. 【转】Linux配置NTP时间同步服务器

    分布式程序通常需要运行在一个统一的时间环境里. 转自:http://blog.csdn.net/mengfanzhundsc/article/details/62046562 安装NTP:yum in ...

  7. python常用模块之-random模块

    random模块顾名思义就是生成随机数的模块. random模块有以下常见方法: 1,打印0-1之间的任意随机浮点数,不能指定区间. print(random.random()) 2,打印随机符点数, ...

  8. 单元测试,模拟用户Get登陆,并携带登录后的token访问接口

    HttpClient _httpClient; HttpClient _businessHttpClient; private async Task<string> GetAccessTo ...

  9. EntityFramework 贪婪加载与延迟加载以及资源回收

    EntityFramework的资源回收 1) Using 内包含Entity的上下文关系,对俩表做Add操作,最好可以直接写一个 entity.SaveChanges(); 完成两张表的同时add操 ...

  10. SQL Server复制入门(一)----复制简介 (转载)

    简介SQL Server中的复制(Replication)是SQL Server高可用性的核心功能之一,在我看来,复制指的并不仅仅是一项技术,而是一些列技术的集合,包括从存储转发数据到同步数据到维护数 ...