poj 2017 Speed Limit
| Time Limit: 1000MS | Memory Limit: 30000K | |
| Total Submissions: 17704 | Accepted: 12435 | 
Description
For example, if their log shows
Speed in miles perhour Total elapsed time in hours 20 2 30 6 10 7 
this means they drove 2 hours at 20 miles per hour, then 6-2=4 hours at 30 miles per hour, then 7-6=1 hour at 10 miles per hour. The distance driven is then (2)(20) + (4)(30) + (1)(10) = 40 + 120 + 10 = 170 miles. Note that the total elapsed time is always since the beginning of the trip, not since the previous entry in their log.
Input
Output
Sample Input
3
20 2
30 6
10 7
2
60 1
30 5
4
15 1
25 2
30 3
10 5
-1
Sample Output
170 miles
180 miles
90 miles
Source
分析:
#include <cstdio>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
using namespace std;
int main(){
int n;
while(cin>>n&&n!=-){
int s,t=,dis=;
while(n--){
int tt;
cin>>s>>tt;
dis+=s*(tt-t);
t=tt;
}
printf("%d miles\n",dis);
}
return ;
}
poj 2017 Speed Limit的更多相关文章
- [ACM] poj 2017 Speed Limit
		Speed Limit Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 17030 Accepted: 11950 Des ... 
- POJ 2017 Speed Limit (直叙式的简单模拟 编程题目 动态属性很少,难度小)
		Sp ... 
- Poj 2017  Speed Limit(水题)
		一.Description Bill and Ted are taking a road trip. But the odometer in their car is broken, so they ... 
- Speed Limit                                                       分类:            POJ             2015-06-09 17:47    9人阅读    评论(0)    收藏
		Speed Limit Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 17967 Accepted: 12596 Des ... 
- E - Speed Limit(2.1.1)
		E - Speed Limit(2.1.1) Time Limit:1000MS Memory Limit:30000KB 64bit IO Format:%I64d & %I ... 
- zoj 2176 Speed Limit
		Speed Limit Time Limit: 2 Seconds Memory Limit: 65536 KB Bill and Ted are taking a road trip. B ... 
- Kattis - Speed Limit
		Speed Limit Bill and Ted are taking a road trip. But the odometer in their car is broken, so they do ... 
- Speed Limit
		http://poj.org/problem?id=2017 #include<stdio.h> int main() { int n,mile,hour; ) { ,h = ; whil ... 
- POJ 2017
		#include<iostream> #include<stdio.h> using namespace std; int main() { //freopen("t ... 
随机推荐
- 接口文档神器Swagger(上篇)
			本文来自网易云社区 作者:李哲 接口文档管理一直是一个让人头疼的问题,伴随着各种接口文档管理平台涌现,如阿里开源的rap,ShowDoc,sosoapi,等等(网上能找到很多这种管理平台,包括我们自己 ... 
- spring-第二章-AOP
			一,回顾 1.控制反转(IOC) 以前创建对象,由我们自己决定,现在我们把管理对象的声明周期权力交给spring; 2.依赖注入(DI) A对象需要B对象的支持,spring就把B注入给A,那么A就拥 ... 
- 【bzoj 3595】: [Scoi2014]方伯伯的Oj
			传送门&& 原题解 蒟蒻终于做到一道方伯伯的题了…… 调了一个上午一直TLE(发现自己打了好久的splay板子竟然是错的这种丢人事情我就不说了) 很明显,要建两棵树,$T1$维护排名, ... 
- mongodb获取具体某一天的查询语句
			比如我要查询截止日期为2010-12-21这一天的数据记录.方法一. db.集合名.find({con_date:new Date("2010/12/21")})1方法二. db. ... 
- [Objective-C语言教程]程序结构(3)
			1. Objective-C Hello World示例 Objective-C程序基本上由以下部分组成 - 预处理程序命令 接口 实现 方法 变量 声明和表达 注释 下面来看一下打印“Hello W ... 
- Ionic开发Hybrid App问题总结
			http://ionichina.com/topic/5641b891b903cba630e25f10 http://www.cnblogs.com/parry/p/issues_about_buil ... 
- 【转】C++ 类访问控制public/private/protected探讨
			示例1:---------------------------------------- class C{ int c1; int c2;public: void set(C* s, int i, i ... 
- 调试K3网页版需要注意的问题
			1.BIN目录下不能存放类名相同的多个文件,即使修改了dll名称也不可以,必须保持唯一性,多余的备份到其他目录 2.引用的标准dll集合需要与当前运行程序的标准dll集合保持一致,可以通过修改引用路径 ... 
- linux的sed(增删改查)使用方法
			sed的增删改查的基本操作 参考:https://www.cnblogs.com/0zcl/p/6855740.html 01:增(a) 2个sed命令,分别是:(这些操作都是在内存中进行的,所以不会 ... 
- python全栈开发_day5_字符串及列表类型
			一:字符串 1)优先掌握知识点. a=" 21j3:b12jk:b3j12:3bjk12 " #内置方法之strip print(a.strip(" ")) # ... 
