HDU1008
来源:互联网 发布:杨他他淘宝客 编辑:程序博客网 时间:2024/06/05 09:45
#include <iostream>#include <cmath>using namespace std;int caculate_time(int a, int b);int main(){int n, i, time = 0;int array[105];while(cin>>n, n != 0){for(i=0; i < n; i++)//输入数组cin >> array[i];//计算第一个时间time = array[0] * 6 + 5;for(i=0; i<n-1; i++)//i从0开始时因为下标为0和下标为1也要进行计算{time = time + caculate_time(array[i], array[i+1]);}cout << time << endl;time = 0;}return 0;}int caculate_time(int a, int b){int sum = 0;if(a - b <0){sum = (b - a) * 6 + 5;}else{sum = (a - b) * 4 + 5;}return sum;}
- hdu1008
- hdu1008
- hdu1008
- hdu1008
- HDU1008
- HDU1008
- HDU1008
- hdu1008
- hdu1008
- HDU1008
- hdu1008
- HDU1008
- HDU1008
- HDU1008
- HDU1008
- HDU1008
- hdu1008
- HDU1008 Elevator
- A星寻路算法介绍
- you don't have permission to access / on this server(Apache Server权限访问问题)
- cocos2d-x节点(CCActionEase.h)API
- c#关于委托和事件(二)(介绍的很详细)
- reference和const reference的初始化
- HDU1008
- (程序员面试题)字符串处理之循环右移
- unicode utf-8 gb18030 gb2312 gbk各种编码对比
- MVC 只是一个思想,不是模式!! (2)
- 文件上传原理:Web上传文件的原理及实现
- 回来看看
- java项目怎样部署到tomcat中
- android中出现Only the original thread that created a view hierarchy can touch its views.错误解决方案
- HDU2899 Strange fuction(牛顿迭代法)