英文题翻译3
2022/1/20 6:47:10
本文主要是介绍英文题翻译3,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
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
这篇关于英文题翻译3的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-13TiDB + ES:转转业财系统亿级数据存储优化实践
- 2024-05-09“2024鸿蒙零基础快速实战-仿抖音App开发(ArkTS版)”实战课程已上线
- 2024-05-09聊聊如何通过arthas-tunnel-server来远程管理所有需要arthas监控的应用
- 2024-05-09log4j2这么配就对了
- 2024-05-09nginx修改Content-Type
- 2024-05-09Redis多数据源,看这篇就够了
- 2024-05-09Google Chrome驱动程序 124.0.6367.62(正式版本)去哪下载?
- 2024-05-09有没有大佬知道这种数据应该怎么抓取呀?
- 2024-05-09这种运行结果里的10.100000001,怎么能最快改成10.1?
- 2024-05-09企业src漏洞挖掘-有意思的命令执行