Game with a Strip
Game with a Strip
Memory limit: 64 MB
Input
Output
Samples
input | output |
---|---|
4 |
Bob |
3 |
Draw |
2 |
Alice |
Notes
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <bitset>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
#define pii pair<int,int>
#define Lson L, mid, ls[rt]
#define Rson mid+1, R, rs[rt]
#define sys system("pause")
const int maxn=1e6+;
using namespace std;
ll gcd(ll p,ll q){return q==?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=;while(q){if(q&)f=f*p%mod;p=p*p%mod;q>>=;}return f;}
inline void umax(int &p,int q){if(p<q)p=q;}
inline void umin(int &p,int q){if(p>q)p=q;}
inline ll read()
{
ll x=;int f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
int n,m,k,t,to[maxn];
char a[maxn];
int dfs(int l,int r,int cnt)
{
if(to[l]>=r)
{
if(a[l]=='A')return ;
else return ;
}
if((r-l+)/%==)return ;
int mid=l+r>>,a=dfs(l,mid,cnt^),b=dfs(mid+,r,cnt^);
if(cnt==)
{
if(a==||b==)return ;
else if(!a||!b)return ;
else return ;
}
else
{
if(a==||b==)return ;
else if(!a||!b)return ;
else return ;
}
}
int main()
{
int i,j;
scanf("%d%s",&n,a);
scanf("%s",a+n);
n<<=;
for(i=n-;i>=;i--)
{
if(a[i]==a[i+])to[i]=to[i+];
else to[i]=i;
}
int ok=dfs(,n-,);
if(ok==)puts("Draw");
else if(ok==)puts("Alice");
else puts("Bob");
return ;
}
Game with a Strip的更多相关文章
- python strip()函数 介绍
python strip()函数 介绍,需要的朋友可以参考一下 函数原型 声明:s为字符串,rm为要删除的字符序列 s.strip(rm) 删除s字符串中开头.结尾处,位于 rm删除 ...
- 4、Python:strip(),split()
1.strip()函数 strip()是删除'()'里面的字符,当()为空时,默认删除空白符(包括'\n','\r','\t','') (1)s.strip(rm) 删除s字符串中开头. ...
- Strip JS – 低侵入,响应式的 Lightbox 效果
Strip 是一个灯箱效果插件,显示的时候只会覆盖部分的页面,这使得侵扰程度较低,并留出了空间与页面上的大屏幕,同时给予小型移动设备上的经典灯箱体验.Strp JS 基于 jQuery 库实现,支持 ...
- strip的用法
函数原型 声明:s为字符串,rm为要删除的字符序列 s.strip(rm) 删除s字符串中开头.结尾处,位于 rm删除序列的字符 s.lstrip(rm) 删除s字符串中开头 ...
- python中strip,lstrip,rstrip简介
一.起因 今天在做角色控制中,有一个地方用到rstrip,判断用户请求的url是否与数据库对应可用权限中url相符. if request.path == x.url or request.path. ...
- 【C++实现python字符串函数库】strip、lstrip、rstrip方法
[C++实现python字符串函数库]strip.lstrip.rstrip方法 这三个方法用于删除字符串首尾处指定的字符,默认删除空白符(包括'\n', '\r', '\t', ' '). s.st ...
- pythong中字符串strip的用法
strip的用法是去除字符串中前后两端的xx字符,xx是一个字符数组,并不是去掉“”中的字符串, 数组中包含的字符都要在字符串中去除.默认去掉空格,lstrip则是去掉左边的,rstrip是右边的 见 ...
- Python strip函数用法小结
声明:s为字符串,rm为要删除的字符序列 s.strip(rm) 删除s字符串中开头.结尾处,位于 rm删除序列的字符 s.lstrip(rm) 删除s字符串中开头处,位于 ...
- python strip() lstrip() rstrip() 使用方法
Python中的strip用于去除字符串的首尾字符串,同理,lstrip用于去除最左边的字符,rstrip用于去除最右边的字符. 这三个函数都可传入一个参数,指定要去除的首尾字符. 需要注意的是,传入 ...
- Linux Strip
一.简介 strip经常用来去除目标文件中的一些符号表.调试符号表信息,以减小程序的大小. 二.语法 https://sourceware.org/binutils/docs/binutils/str ...
随机推荐
- poj--1274--The Perfect Stall(匈牙利裸题)
The Perfect Stall Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 21868 Accepted: 980 ...
- 【POJ 2676】 Sudoku
[题目链接] http://poj.org/problem?id=2676 [算法] 深度优先搜索 [代码] #include <algorithm> #include <bitse ...
- AAC帧格式及编码介绍
参考资料: AAC以adts格式封装的分析:http://wenku.baidu.com/view/45c755fd910ef12d2af9e74c.html aac编码介绍:http://wenku ...
- aspectc中this可以获取的东西
this->kind 操作类型 this->targetName 被调用函数名称 this->funcName 调用函数名称 this->argsCount 参数个数 thi ...
- web.xml中load-on-startup
<servlet> <servlet-name>SystemInit</servlet-name> <servlet-class>sjgl.system ...
- Spell checker(串)
http://poj.org/problem?id=1035 题意:给定一个单词判断其是否在字典中,若存在输出"%s is correct",否则判断该单词删掉一个字母,或增加一个 ...
- 原生JS---6
原生js学习笔记6——事件 事件对象 鼠标事件 event.clientX在可视区中,鼠标点击的x坐标 event.clientY在可视区中,鼠标点击的y坐标 示例: <!DOCTYPE htm ...
- 自学Python十 爬虫实战三(美女福利续)
我又来送福利啦!!!不同于上篇文章,这次我们的爬虫采用了多线程,一直以来被所谓的分布式 多线程 爬虫 给唬的怕怕的.今天就来一发多线程爬虫吧,还能看妹子图,想想就觉得很激动!!! 依然是流程解释: ...
- Laravel5.1学习笔记9 系统架构1 请求生命周期 (待修)
Request Lifecycle Introduction Lifecycle Overview Focus On Service Providers Introduction When using ...
- 2018年排名前20的数据科学Python库
Python 在解决数据科学任务和挑战方面继续处于领先地位.业已证明最有帮助的Python库,我们选择 20 多个库,因为其中一些库是相互替代的,可以解决相同的问题.因此,我们将它们放在同一个分组. ...