CodeForces 705B Spider Man】的更多相关文章

题目链接: http://codeforces.com/problemset/problem/705/B 题目大意: 两个人玩游戏,总共N个数,分别求前I(I=1 2 3...n)个数时游戏的获胜者是谁. 游戏规则是可以把一个大于2的数拆成任意大小的两个数,1不能拆,问谁先不能拆谁输.先手输输出2,后手输输出1. 题目思路: [模拟] 很容易想到把一个数拆成两个数,不管怎么拆最后都会被拆成k个1,所以只要判断前I个数的奇偶就行了.(如果是1直接跳过,答案和上一把一样,因为1不能拆) // //b…
题意:给定 n 个数,表示不同的环,然后把环拆成全是1,每次只能拆成两个,问你有多少次. 析:也不难,反正都要变成1,所以把所有的数都减1,再求和即可. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include &…
水题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> #incl…
题目链接: B. Spider Man time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Peter Parker wants to play a game with Dr. Octopus. The game is about cycles. Cycle is a sequence of vertices, such that…
Description Peter Parker wants to play a game with Dr. Octopus. The game is about cycles. Cycle is a sequence of vertices, such that first one is connected with the second, second is connected with third and so on, while the last one is connected wit…
题目链接:http://codeforces.com/problemset/problem/705/B 题意略解: 两个人玩游戏,解数字,一个数字可以被分成两个不同或相同的数字 (3可以解成 1 2),最小1不能再解 示例1: 第一把 当前1号玩家开始解数字 1,不能解, 则2号赢 输出2 第二把 当前数字为 1 2, 1号玩家直接对 2 进行解 解成 1 1,数字为 1 1 1,2号玩家无解,1号赢 第三把 当前数字为 1 2 3,一号玩家先对 2 解,解成 1 1,数字为 1 1 1 3,2…
题目链接:http://codeforces.com/problemset/problem/216/D 题意: 对于一个梯形区域,假设梯形左边的点数!=梯形右边的点数,那么这个梯形为红色.否则为绿色, 问: 给定的蜘蛛网中有多少个红色. 2个树状数组维护2个线段.然后暴力模拟一下,由于点数非常多但须要用到的线段树仅仅有3条,所以类似滚动数组的思想优化内存. #include<stdio.h> #include<iostream> #include<string.h> #…
第二弹: 套路&&经验总结: 1. N堆***的游戏,一般可以打表找SG函数的规律.比如CodeForces 603C 2.看起来是单轮的游戏,实际上可能拆分成一些独立的子游戏.比如CodeForces 317D 3.考虑最终如果某方胜利,最后的局面会是怎样. 比如CodeForces 594A 4.大力分类讨论,不要怕麻烦,在纸上写清楚. 比如 CodeForces 455B CodeForces 794C 题目大意: A和B各有一个大小为N的可重复字符集合,然后两个人轮流,每次取出从自…
K - Cross SpiderTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87794#problem/K Description The Bytean cross spider (Araneida baitoida) is known to have an amazing ability. Namely, it can instantly b…
B. Spider Man time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Peter Parker wants to play a game with Dr. Octopus. The game is about cycles. Cycle is a sequence of vertices, such that first…