ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

英文题翻译3

2022-01-20 00:00:58  阅读:185  来源: 互联网

标签:翻译 sequence color 样例 ci 英文 序列 integer


Color Sequence

 1000ms  65536K

Color Sequence | JXNUOJ

描述

You are given a integer sequence c of length n, ci denotes the ith color in the sequence c.

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,0is illegal because color 1 only appear 1 time, and 1 is not an even number.

Now, you need to figure out how many consecutive subsequence of c that is a legal color sequence.

输入:

The first line contains one integer n(1≤n≤10的6次方), the length of the sequence c.

The second line contains n integer, the ith integer denotes the ith color, )ci(0≤ci≤20).

输出:

Print one integer as the answer.

样例输入:

3
1 1 1

样例输出:

2

--------------------------------------------------------------------------------------------------------

描述:

给你一个长度为nn的整数序列c,ci代表序列c的第i个颜色。

我们定义当一个序列只由偶数个颜色组成时它是合法的。

例如,序列0,1,0,1是合法的,应为颜色1,0都出现了2次,且2是一个偶数。而数列010是不合法的,因为1只出现了1次,1不是偶数。

现在,你需要知道有多少个c的子序列是合法的。

输入:

第一行由一个整数n(1≤n≤10的6次方)组成,为c的长度。

第二行有n个整数,第i个整数表示i的颜色ci(0≤ci≤20)。

输出:

输出一个整数答案。

样例输入:

3
1 1 1

样例输出:

2

标签:翻译,sequence,color,样例,ci,英文,序列,integer
来源: https://blog.csdn.net/xuuuuux/article/details/122589945

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有