• POJ 2501


     1 #include<iostream>
     2 #include<iomanip>
     3 #include<stdio.h>
     4 #include<string>
     5 #include<math.h>
     6 using namespace std;
     7 
     8 int main()
     9 {
    10     //freopen("acm.acm","r",stdin);
    11     string s;
    12     int i;
    13     double speed = 0.0;
    14     double road;
    15     double time;
    16     double time1;
    17     double past;
    18     time = 0;
    19     past = 0;
    20     road = 0;
    21     getline(cin,s);
    22     time = (double(s[0]-'0')*10.0+double(s[1]-'0'))+(double(s[3]-'0')*10.0+double(s[4]-'0'))/60.0+(double(s[6]-'0')*10.0+double(s[7]-'0'))/3600.0;
    23     if(s.length() > 8)
    24     {
    25         for(i =  9; i < s.length(); ++ i)
    26         {
    27             speed = speed*10.0 + double(s[i]-'0');
    28         }
    29     }
    30     else
    31     {
    32         cout<<s<<" "<<"0.00 km"<<endl;
    33     }
    34     time *= 60;
    35     while(getline(cin,s))
    36     {
    37         if(s.length() > 8)
    38         {
    39             time1 = (double(s[0]-'0')*10.0+double(s[1]-'0'))+(double(s[3]-'0')*10.0+double(s[4]-'0'))/60.0+(double(s[6]-'0')*10.0+double(s[7]-'0'))/3600.0;
    40             time1 *= 60.0;
    41             past += speed*(time1-time);
    42             time = time1;
    43             speed = 0;
    44             for(i =  9; i < s.length(); ++ i)
    45             {
    46                 speed = speed*10.0 + double(s[i]-'0');
    47             }
    48         }
    49         if(s.length() == 8)
    50         {
    51             time1 = (double(s[0]-'0')*10.0+double(s[1]-'0'))+(double(s[3]-'0')*10.0+double(s[4]-'0'))/60.0+(double(s[6]-'0')*10.0+double(s[7]-'0'))/3600.0;
    52             time1 *= 60.0;
    53             cout<<s<<' ';
    54             cout<<setiosflags(ios::fixed)<<setprecision(2)<<(speed*(time1-time)+past)/60.0<<' '<<"km"<<endl;
    55         }
    56     }
    57     
    58 }
  • 相关阅读:
    10分钟学会React Context API
    Soft skill
    前端-页面性能调试:Hiper
    js对secure的支持是没问题的,httponly是为限制js而产生的,当然httponly的cookie也不会被js创建
    关于go的不爽
    Windows上mxnet实战深度学习:Neural Net
    wget获取https资源
    使用windows上 mxnet 预编译版本
    NVIDA 提到的 深度框架库
    Windows下编译mxnet
  • 原文地址:https://www.cnblogs.com/gavinsp/p/4568445.html
Copyright © 2020-2023  润新知