2022 01.21第五天
Color Sequence
https://acs.jxnu.edu.cn/problem/ICPCJX2020E
1000ms 65536K
描述:
You are given a integer sequence c of length n, ci denotes the ith color in the sequence c.
给定长度为n的整数序列c,ci表示序列c中的第i种颜色。
We define a color sequence is legal only if it merely contains colors that appear even number of times.
我们定义一个颜色序列只有当它仅仅包含偶数次出现的颜色时才是合法的。
For example, sequence 0,1,0,1 is legal because both color 1 and 0 appear 2 times, and 2 is an even number. And sequence 0,1,0 is illegal because color 1 only appear 1 time, and 1 is not an even number.
例如,序列0,1,0,1是合法的,因为颜色1和0都出现2次,而2是偶数。并且序列0,1,0是非法的,因为颜色1只出现1次,1不是偶数
Now, you need to figure out how many consecutive subsequence of c that is a legal color sequence.
现在,您需要计算出c的连续子序列中有多少是合法的颜色序列。
输入:
The first line contains one integer n(1≤n≤106), the length of the sequence c.
第一行包含一个n,n是c序列的长度。
The second line contains n integer, the ith integer denotes the ith color, ci(0≤ci≤20).
第二行包含n个整数,第i个整数表示第i个颜色,ci(0≤ci≤20)
输出:
Print one integer as the answer.
输出答案
样例输入:
3
1 1 1
样例输出:
2
even number. 偶数