题目链接:

  http://codeforces.com/problemset/problem/705/B

题目大意:

  两个人玩游戏,总共N个数,分别求前I(I=1 2 3...n)个数时游戏的获胜者是谁。

  游戏规则是可以把一个大于2的数拆成任意大小的两个数,1不能拆,问谁先不能拆谁输。先手输输出2,后手输输出1。

题目思路:

  【模拟】

  很容易想到把一个数拆成两个数,不管怎么拆最后都会被拆成k个1,所以只要判断前I个数的奇偶就行了。(如果是1直接跳过,答案和上一把一样,因为1不能拆)

 //
//by coolxxx
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<map>
#include<memory.h>
#include<time.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//#include<stdbool.h>
#include<math.h>
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define abs(a) ((a)>0?(a):(-(a)))
#define lowbit(a) (a&(-a))
#define sqr(a) ((a)*(a))
#define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))
#define mem(a,b) memset(a,b,sizeof(a))
#define eps (1e-8)
#define J 10
#define mod 1000000007
#define MAX 0x7f7f7f7f
#define PI 3.14159265358979323
#define N 100004
using namespace std;
typedef long long LL;
int cas,cass;
int n,m,lll,ans;
int a[N];
int main()
{
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
// freopen("2.txt","w",stdout);
#endif
int i,j,k;
// for(scanf("%d",&cas);cas;cas--)
// for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
// while(~scanf("%s",s+1))
while(~scanf("%d",&n))
{
j=;
for(i=;i<=n;i++)
{
scanf("%d",&a[i]);
if(a[i]!=)
j=(j+a[i]-)%;
if(j==)puts("");
else puts("");
}
}
return ;
}
/*
// //
*/

【模拟】Codeforces 705B Spider Man的更多相关文章

  1. CodeForces 705B Spider Man (水题)

    题意:给定 n 个数,表示不同的环,然后把环拆成全是1,每次只能拆成两个,问你有多少次. 析:也不难,反正都要变成1,所以把所有的数都减1,再求和即可. 代码如下: #pragma comment(l ...

  2. CodeForces 705B Spider Man

    水题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #includ ...

  3. Codeforces 216D Spider&#39;s Web 树状数组+模拟

    题目链接:http://codeforces.com/problemset/problem/216/D 题意: 对于一个梯形区域,假设梯形左边的点数!=梯形右边的点数,那么这个梯形为红色.否则为绿色, ...

  4. codeforces 705B B. Spider Man(组合游戏)

    题目链接: B. Spider Man time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  5. codeforces 705B:Spider Man

    Description Peter Parker wants to play a game with Dr. Octopus. The game is about cycles. Cycle is a ...

  6. 贪心+模拟 Codeforces Round #288 (Div. 2) C. Anya and Ghosts

    题目传送门 /* 贪心 + 模拟:首先,如果蜡烛的燃烧时间小于最少需要点燃的蜡烛数一定是-1(蜡烛是1秒点一支), num[g[i]]记录每个鬼访问时已点燃的蜡烛数,若不够,tmp为还需要的蜡烛数, ...

  7. 模拟 Codeforces Round #203 (Div. 2) C. Bombs

    题目地址:http://codeforces.com/problemset/problem/350/C /* 题意:机器人上下左右走路,把其他的机器人都干掉要几步,好吧我其实没读懂题目, 看着样例猜出 ...

  8. 模拟 Codeforces Round #249 (Div. 2) C. Cardiogram

    题目地址:http://codeforces.com/contest/435/problem/C /* 题意:给一组公式,一组数据,计算得到一系列的坐标点,画出折线图:) 模拟题:蛮恶心的,不过也简单 ...

  9. 模拟 Codeforces Round #297 (Div. 2) A. Vitaliy and Pie

    题目传送门 /* 模拟:这就是一道模拟水题,看到标签是贪心,还以为错了呢 题目倒是很长:) */ #include <cstdio> #include <algorithm> ...

随机推荐

  1. codevs1380 没有丧尸的舞会

    /* 树形DP 而然我并不知道树在哪(....) f[x][0]表示x节点不参加舞会 以x为根的子树的最优解 f[x][1]表示x节点参加舞会 以x为根的子树的最优解 方程为:(so为x的儿子 so要 ...

  2. table转list

    DataTable数据集转换为List非泛型以及泛型方式 前言 DataTable是断开式的数据集合,所以一旦从数据库获取,就会在内存中创建一个数据的副本,以便使用.由于在实际项目中,经常会将 Dat ...

  3. PHP 正则表达式匹配 preg_match 与 preg_match_all 函数

    --http://www.5idev.com/p-php_preg_match.shtml 正则表达式在 PHP 中的应用 在 PHP 应用中,正则表达式主要用于: 正则匹配:根据正则表达式匹配相应的 ...

  4. Android Cursor类的概念和用法

    http://www.2cto.com/kf/201109/103163.html 关于 Cursor 在你理解和使用 Android Cursor 的时候你必须先知道关于 Cursor 的几件事情: ...

  5. Asp.net Mvc4 基于Authorize实现的模块访问权限

    在MVC中,我们可以通过在action或者controller上设置Authorize[Role="xxx"] 的方式来设置用户对action的访问权限.显然,这样并不能满足我们的 ...

  6. Android- Activity not found

    今天调试代码的时候,出现很奇怪的现象: \XX\bin\Home.apk installed on device. 一般来说即使已经装到设备中,也没有这个提示,况且更奇怪的是,程序并又有自动运行.查看 ...

  7. decimal to hexadecimal,binary and octonary.

    Here is a simple algorithm about 'decimal' to 'dexadecimal',and the implementation code: /* Convert ...

  8. mysql 数据sqoop到hive 步骤

    1.hive建表 hive是支持分区的,但是这次建表没有写分区. CREATE TABLE `cuoti_rpt` ( `COURSE_ID` string, `NAME` string, `PERI ...

  9. 《zip命令》-linux命令五分钟系列之九

    本原创文章属于<Linux大棚>博客. 博客地址为http://roclinux.cn. 文章作者为roc 希望您能通过捐款的方式支持Linux大棚博客的运行和发展.请见“关于捐款” == ...

  10. php && 逻辑与运算符使用说明

    例子:!defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc()); o(︶︿︶ ...