The Game Of Parity Solution: 这个题只需要分类讨论就可以解决. 先分别统计奇数和偶数的个数. 然后判断谁走最后一步,如果走最后一步时候同时有偶数和奇数,那么走最后一步的赢.如果没有呢,就看剩下的是奇数还是偶数,是偶数不用说,是奇数看剩奇数个还是偶数个. 针对这几种情况讨论一下就可以. #include <bits/stdc++.h> using namespace std; int n, k, o, e; int main() { cin >> n &g…
C. The Game Of Parity time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n cities in Westeros. The i-th city is inhabited by ai people. Daenerys and Stannis play the following game:…
C. The Game Of Parity time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n cities in Westeros. The i-th city is inhabited by ai people. Daenerys and Stannis play the following game:…
题目链接:http://codeforces.com/problemset/problem/549/C C. The Game Of Parity time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n cities in Westeros. The i-th city is inhabited by ai pe…
题意:两个人有n1,n2个球,然后分别最多拿出 k1,k2个球,然后扔掉,谁先拿完谁输. 析:很简单么,每人都足够聪明,就每次扔一个好了,那么,谁的球多,谁就能赢呗,如果相等,那么第一个扔的输. 代码如下: #include <iostream> #include <cstdio> using namespace std; int main(){ int n, m, k, l; cin >> n >> m >> k >> l; if(…
E. Game of Stones Sam has been teaching Jon the Game of Stones to sharpen his mind and help him devise a strategy to fight the white walkers. The rules of this game are quite simple: The game starts with n piles of stones indexed from 1 to n. The i…