DFS搜索

# D - Some Sum

## 题目描述

Your friend has secretly picked N consecutive positive integers between 1 and 100, and wants you to guess if their sum is even or odd.
If the sum must be even, output `Even`. If the sum must be odd, output `Odd`. If the sum could be even or could be odd, output `Either`.

## 输入

The input is a single integer N with `1≤N≤10`.

## 输出

Output a single word. The word should be `Even`, `Odd`, or
`Either`, according to the rules given earlier.

Input

Output

Input

Output

## 解题思路

1.奇数的个数=偶数的个数=n，此时相当于n/2个奇数相加。

2.奇数的个数=偶数的个数+1，按上述情况考虑并加一个奇数。

3.偶数的个数=奇数的个数+1，按上述情况考虑并加一个偶数。

Odd—奇数

Even—偶数

# F - Pulling Their Weight

## 题目描述

To save money, Santa Claus has started hiring other animals besides reindeer to pull his sleigh via short term ‘gig’ contracts. As a result, the actual animals that show up to pull his sleigh for any given trip can vary greatly in size.

Last week he had 2 buffalo, 37 voles and a schnauzer. Unfortunately, both buffalo were hitched on the left side and the entire sleigh flipped over in mid-flight due to the weight imbalance.

To prevent such accidents in the future, Santa needs to divide the animals for a given trip into two groups such that the sum of the weights of all animals in one group equals the sum of the weights of all animals in the other. To make the hitching process efficient, Santa is seeking an integer target weight t such that all animals that are lighter than t go in one group and those
heavier than t go into the other. If there are multiple such t, he wants the smallest one. There’s one small wrinkle: what should be done if there some animals have weight exactly equal to t? Santa solves the problem this way: if there are an even number of such animals, he divides them equally among the two groups (thus distributing the weight evenly). But if there are an odd number of such animals, then one of those animals is sent to work with the elves to make
toys (it is not put in either group), and the remaining (now an even number) are divided evenly among the two groups.

## 输入

Input describes a list of animals’ weights. The first line contains an integer m (`2≤m≤10^5^`), indicating the number of animals. The next m lines each have a positive integer. These are the weights of the animals (in ounces).

Animals weighing more than `20000` ounces are too big to pull the sleigh so no given weight will exceed this maximum.

## 输出

Output the smallest integer target weight t, as described above. It’s
guaranteed that it is possible to find such an integer.

Input

Output

Input

Output

Input

Output

reindeer—驯鹿

sleigh—雪橇

buffalo—水牛

voles—田鼠

schnauze—髯狗

elves—精灵

ounces—盎司

BFS最短路

# J - This Ain’t Your Grandpa’s Checkerboard

## 题目描述 You are given an n−by−n grid where each square is colored either black or white. A grid is correct if all of the following conditions are satisfied:

• ​ Every row has the same number of black squares as it has white squares.

• ​ Every column has the same number of black squares as it has white squares.

• ​ No row or column has 3 or more consecutive squares of the same color.

Given a grid, determine whether it is correct.

## 输入

The first line contains an integer n(2≤n≤24; n is even) . Each of the next n lines contains a string of length n consisting solely of the characters ‘B’ and ‘W’, representing the colors of the grid squares.

## 输出

If the grid iscorrect, print the number 1 on a single line. Otherwise, print the number 0 on a single line.

Input

Output

Input

Output

Input

Output

Input

Output