当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5174:Ferries Wheel

题目描述
The Ferries Wheel is a circle,rounded by many cable cars,and the cars are numbered $1,2,3...K-1,K$ in order.Every cable car has a unique value and $A[i-1] < A[i] < A[i+1] (1<i<K)$.


Today,Misaki invites $N$ friends to play in the Ferries Wheel.Every one will enter a cable car. One person will receive a kiss from Misaki,if this person satisfies the following condition: (his/her cable car's value + the left car's value
) % INT_MAX = the right car's value,the ${1}^{st}$ car’s left car is the ${k}^{th}$ car,and the right one is ${2}^{nd}$ car,the ${k}^{th}$ car’s left car is the ${(k-1)}^{th}$ car,and the right one is the ${1}^{st}$ car.

Please help Misaki to calculate how many kisses she will pay,you can assume that there is no empty cable car when all friends enter their cable cars,and one car has more than one friends is valid.
输入解释
There are many test cases.
For each case,the first line is a integer $N(1<=N<=100)$ means Misaki has invited $N$ friends,and the second line contains $N$ integers $val1,val2,...valN$, the $val[i]$ means the ${i}^{th}$ friend's cable car's value.
$(0<= val[i] <=$ INT_MAX).

The INT_MAX is $2147483647$.
输出解释
For each test case, first output Case #X: ,then output the answer, if there are only one cable car, print "-1";
输入样例
3
1 2 3
5
1 2 3 5 7
6
2 3 1 2 7 5
输出样例
Case #1: 1
Case #2: 2
Case #3: 3

提示
In the third sample, the order of cable cars is {{1},{2}, {3}, {5}, {7}} after they enter cable car,but the 2nd cable car has 2 friends,so the answer is 3.
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 Valentine's Day Round

源链接: HDU-5174

最后修改于 2020-10-25T23:20:25+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/65536K(Java/Others)