POJ 2501
#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<string>
#include<math.h>
using namespace std; int main()
{
//freopen("acm.acm","r",stdin);
string s;
int i;
double speed = 0.0;
double road;
double time;
double time1;
double past;
time = ;
past = ;
road = ;
getline(cin,s);
time = (double(s[]-'')*10.0+double(s[]-''))+(double(s[]-'')*10.0+double(s[]-''))/60.0+(double(s[]-'')*10.0+double(s[]-''))/3600.0;
if(s.length() > )
{
for(i = ; i < s.length(); ++ i)
{
speed = speed*10.0 + double(s[i]-'');
}
}
else
{
cout<<s<<" "<<"0.00 km"<<endl;
}
time *= ;
while(getline(cin,s))
{
if(s.length() > )
{
time1 = (double(s[]-'')*10.0+double(s[]-''))+(double(s[]-'')*10.0+double(s[]-''))/60.0+(double(s[]-'')*10.0+double(s[]-''))/3600.0;
time1 *= 60.0;
past += speed*(time1-time);
time = time1;
speed = ;
for(i = ; i < s.length(); ++ i)
{
speed = speed*10.0 + double(s[i]-'');
}
}
if(s.length() == )
{
time1 = (double(s[]-'')*10.0+double(s[]-''))+(double(s[]-'')*10.0+double(s[]-''))/60.0+(double(s[]-'')*10.0+double(s[]-''))/3600.0;
time1 *= 60.0;
cout<<s<<' ';
cout<<setiosflags(ios::fixed)<<setprecision()<<(speed*(time1-time)+past)/60.0<<' '<<"km"<<endl;
}
} }
POJ 2501的更多相关文章
- poj 2501 Average Speed
Average Speed Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4842 Accepted: 2168 Des ...
- POJ 1039 Pipe【经典线段与直线相交】
链接: http://poj.org/problem?id=1039 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22013#probl ...
- 【POJ 3026】Borg Maze
id=3026">[POJ 3026]Borg Maze 一个考察队搜索alien 这个考察队能够无限切割 问搜索到全部alien所须要的总步数 即求一个无向图 包括全部的点而且总权值 ...
- poj和hdu部分基础算法分类及难度排序
最近想从头开始刷点基础些的题,正好有个网站有关于各大oj的题目分类(http://www.pythontip.com/acm/problemCategory),所以写了点脚本把hdu和poj的一些题目 ...
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
- POJ 3254. Corn Fields 状态压缩DP (入门级)
Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9806 Accepted: 5185 Descr ...
随机推荐
- hdu-1036(格式题+精确度)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1036 心得:注意,要进行四舍五入的精确可以用+0.5实现. #include<iostream& ...
- .NET性能优化(文摘)
第1章 性能指标 1.1 性能目标 1.2 性能指标 第2章 性能度量 2.1 性能度量方式 白盒测试-小程序 黑盒测试-大型程序 2.2 Windows内置工具 2.2.1 性能计数器 2.2.2 ...
- CHAPITRE III
Il me fallut longtemps pour comprendre d'où il venait. Le petit prince, qui me posait beaucoup de qu ...
- 第07章:MongoDB-CRUD操作--文档--创建
①语法 insert() save() --有修改没有新增 insertOne() [3.2版本新增]向指定集合中插入一条文档数据 insertMany() [3.2版本新增]向指定集合中插入多条文 ...
- C#的委托与Java的自定义接口的异曲同工的同步操作
C#的委托(以WinForm为例) 在子窗体(ChildFrm)中定义一个委托 this.CaptureListener(callback);//子窗体触发委托事件,以告诉调用的窗体 /// < ...
- poj 2506 Tiling(高精度)
Description In how many ways can you tile a 2xn rectangle by 2x1 or 2x2 tiles? Here is a sample tili ...
- [转]Android SQLite
数据库操作SQLite Expert Personal 3 注:下载相关SQLite的文档在:http://www.sqlite.org/ 具体的sql语句不作长细介绍,在本博客中也有相关的文章. 一 ...
- Objective-C:01简介
1.Objective-C简介 Objective-C是一种面向对象的计算机语言 OC不是一门全新的语言 C语言的基础上增加了一层最小的面向对象语法 OC完全兼容C语言 可以在OC代码中混入C语言代码 ...
- STL其他--<tuple>用法【C11】
tuple 库 tuple 库 是能够将不同类型的对象组合起来形成一个对象.和pair 对象一样,但是可以组织多种不同类型的元素. tuple中的元素类型是在编译时期决定的.与<utility ...
- hdu1258
给你两个数t,n 接下来输入n个数字 让你输出所有数字相加等于n的组合 4 6 4 3 2 2 1 1 t n 4 3+1 2+2 2+1+1 Sample Input 4 6 4 3 2 2 1 1 ...