标签:style io for sp amp on size c as
题解:简单模拟
#include <cstdio>
int main(){
int n,tmp,ans,now,pre;
while(~scanf("%d",&n)&&n){
ans=0; pre=0;
for(int i=0;i<n;i++){
scanf("%d",&now);
tmp=now-pre;
if(tmp>0)ans+=(tmp*6+5);
else if(tmp<0)ans+=(-tmp*4+5);
else ans+=5; pre=now;
}printf("%d\n",ans);
}return 0;
}
标签:style io for sp amp on size c as
原文地址:http://www.cnblogs.com/forever97/p/3945079.html