经典指数          
POJ
原因
1159
浏览数
0
收藏数
 

Farmer John has received a noise complaint from his neighbor, Farmer Bob, stating that his cows are making too much noise. FJ's N c输入描述 * Line 1: N * Lines 2..N+1: The location of each cow (in the range 0..1,000,000,000).输出描述 There are five cows at locations 1, 5, 3, 2, and 4.输入例子 5 1 5 3 2 4 输出例子 40 Hint INPUT DETAILS: There are five cows at locations 1, 5, 3, 2, and 4. OUTPUT DETAILS: Cow at 1 contributes 1+2+3+4=10, cow at 5 contributes 4+3+2+1=10, cow at 3 contributes 2+1+1+2=6, cow at 2 contributes 1+1+2+3=7, and cow at 4 contributes 3+2+1+1=7. The total volume is (10+10+6+7+7) = 40.

     举报   纠错  
 
切换
暂时还没有答案,欢迎分享你的解答 . . .
撰写答案
扫描后移动端查看本题