题目链接 http://www.lydsy.com/JudgeOnline/problem.php?id=3043
【题目描述】
给定一个长度为 n 的数列{a1,a2...an},每次可以选择一个区间[l,r],使这个区间内的数
都加一或者都减一。
问至少需要多少次操作才能使数列中的所有数都一样,并求出在保证最少次数的前提下,
最终得到的数列有多少种。
【输入格式】
第一行一个正整数 n ,接下来 n 行,每行一个整数,第 i+1 行的整数表示 ai。
【输出格式】
第一行输出最少操作次数,第二行输出最终能得到多少种结果
【 Sample Input1】
4 1 1 2 2
【 Sample Output1】
1 2
相关文章
- hdu 5204 Rikka with sequence 智商不够系列
- HDU 5828 Rikka with Sequence(线段树 开根号)
- HDU 5828 Rikka with Sequence(线段树)
- HDU 5828 Rikka with Sequence (线段树)
- HDU 5828 Rikka with Sequence
- leetcode 60. Permutation Sequence(康托展开)
- hdu1005 Number Sequence(寻找循环节)
- 课程五(Sequence Models),第二 周(Natural Language Processing & Word Embeddings) —— 1.Programming assignments:Operations on word vectors - Debiasing
- HDU1005——Number Sequence,HDU1006——Tick and Tick,HDU1007——Quoit Design
- HDU5950 Recursive sequence (矩阵快速幂加速递推) (2016ACM/ICPC亚洲赛区沈阳站 Problem C)