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后和给 ...
随机推荐
- 【代码笔记】iOS-字符串替换回车和换行
一,代码. - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, ...
- Sqoop安装与应用过程
1. 参考说明 参考文档: http://sqoop.apache.org/ http://sqoop.apache.org/docs/1.99.7/admin/Installation.html ...
- CSS控制Span强制换行亲测
span { word-wrap: break-word; word-break: break-all; white-space: pre-wrap !important; }
- AppManager
1.统一应用程序中所有的Activity的栈管理 涉及到activity的添加.删除指定.删除当前.删除所有.返回栈大小的方法 public class AppManager { private S ...
- C#取得控制台应用程序的根目录方法 判断文件夹是否存在,不存在就创建
取得控制台应用程序的根目录方法1:Environment.CurrentDirectory 取得或设置当前工作目录的完整限定路径2:AppDomain.CurrentDomain.BaseDirect ...
- MAC安装了mumu安卓模拟器,但无法检测到该模拟器
1.adb devices 看不到模拟器 2.adb connect 127.0.0.1:5555 3.adb kill-server 没有报错,即成功 4. adb start-server ...
- As3截图转换为ByteArray传送给后台node的一种方法
最近将以前用As3+Php做的一个画板拿出来改成了As3+nodejs(expressjs4). Node: 1. 将图片存放的路径设置为静态公开的路径. app.use(express.static ...
- Chained Declustering
此论文描述了在无共享架构的多处理器机器上的数据库系统的数据冗余分布方法.该方法提高了系统的可用性,同时在单节点故障的情况下,可以很好的实现负载均衡.以下是论文的一些摘要,详细可以参见论文原 ...
- python的函数(二)
1,函数的变量 2,函数的返回值 1,函数的变量 1.0,函数的变量分为局部变量和全局变量. def fun(): x = 100 print x 这个x是局部变量,函数执行完后,x的变量就会销毁,只 ...
- WCF 基于 WinForm 宿主 发布
ServiceHost Host = new ServiceHost(typeof(ServiceHTTP)); //绑定 System.ServiceModel.Channels.Binding h ...