标签:one math bottom cos amp content output uil lis
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 74488 Accepted Submission(s):
41075
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cmath> 5 #include <queue> 6 #include <algorithm> 7 using namespace std; 8 int main() 9 { 10 int n,m,sum,lag; 11 queue<int>mp; 12 while(scanf("%d",&n)&&n) 13 { 14 sum=0; 15 lag=0; 16 for(int i=0;i<n;i++) 17 { 18 scanf("%d",&m); 19 mp.push(m); 20 } 21 while(!mp.empty()) 22 { 23 m=mp.front(); 24 mp.pop(); 25 sum+=abs(m-lag)*((lag-m)>0?4:6); 26 lag=m; 27 sum+=5; 28 } 29 printf("%d\n",sum); 30 } 31 return 0; 32 }
标签:one math bottom cos amp content output uil lis
原文地址:http://www.cnblogs.com/52why/p/7478104.html