首页 > 其他 > 详细

hdu 1008 水

时间:2015-03-10 00:12:13      阅读:296      评论:0      收藏:0      [点我收藏+]

背景:水

#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;

int main(void){
    int t;
    while(scanf("%d",&t),t){
        int ans=0,temp1,temp2=0;
        for(int i=1;i <= t;i++){
            scanf("%d",&temp1);
            if(temp1 > temp2) ans+=(temp1-temp2)*6+5;
            else if(temp2 > temp1) ans+=(temp2-temp1)*4+5;
            else ans+=5;
            temp2=temp1;
        }
        printf("%d\n",ans);
    }
    return 0;
}


hdu 1008 水

原文:http://blog.csdn.net/jibancanyang/article/details/44136367

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!