# ZZNUOJ 2112 : Attack City and Capture Territory

## 题目:

The Three Kingdoms period was a relatively famous period in the history of China. From the Battle of Chibi (AD 211) to the reunification of China in the Western Jin Dynasty(AD 280). During the period, Cao’s Wei State, Liu’s Shu State, and Sun’s Wu Guo’s Three Kingdoms stood together. Therefore, it was called the Three Kingdoms period.

In the last years of the Eastern Han Dynasty, Dong_ Z specialized in power , the coalition forces of the world’s princes crusade against each other. Among them, Liu_B and Sun_Q, who are school students, also participated in the crusade.

In AD 215 , Liu_B and Sun_Q simultaneously attacked JingZhou and directly threatened Dong Z’s city. There were N firepower points on the high wall, each fire point with different s trength Xi . Liu_B and Sun_Q looked at the high walls and the strong gates, they did not attack the city traightaway. They negotiate to attack firepower point alternately. Who breaks through the last firepower point, he will win the city.

Because of limited weaponry, weapons of each side can only attack one firepower at a time. But they can control whether completely destroy this firepower point or weaken the strength of firepower point.

Liu_B has a strong think-tank. After calculation, he finds out who will attack first , who will more likely win the city .

## Input:

The first line of the input contains one integer T, which is the number of test cases (1<=T<=10). Each test case specifies:

Line 1: N ( 1 ≤ N ≤ 100 )

Line 2: X1 X2… Xn ( 1 <= Xi<=1000 i=1…. n)

## Output:

For each test case , print “Liu_B is sure to win.” Or “Liu_B is not sure to win.” , suppose Liu_B first attacks.

## Sample Input:

3

2

1 3

2

3 3

5

1 2 3 4 5

## Sample Output:

Liu_B is sure to win.

Liu_B is not sure to win.

Liu_B is sure to win.

### 题目链接

2018河南省赛尼姆博弈。

## AC代码:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
#include <bits/stdc++.h> using namespace std; #define mem(a,b) memset(a,b,sizeof(a)) #define pb push_back typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> P; const int INF = 0x3f3f3f3f; const int maxn = 1e2+5; const int mod = 1e9+7; const double eps = 1e-8; const double pi = asin(1.0)*2; const double e = 2.718281828459; void fre() { freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout); } int t; int n; int a[maxn]; int temp; int main(){ //fre(); scanf("%d", &t); while(t--) { temp = 0; scanf("%d", &n); for (int i = 0; i < n; ++i) { scanf("%d", &a[i]); temp ^= a[i]; } if (temp) { printf("Liu_B is sure to win.\n"); } else { printf("Liu_B is not sure to win.\n"); } } return 0; } |

## 发表评论