Taxi Fare
来源:互联网 发布:mac ps字体包下载 编辑:程序博客网 时间:2024/04/28 14:02
Taxi Fare
Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 26 Accepted Submission(s) : 14
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
Problem Description
Last September, Hangzhou raised the taxi fares.
The original flag-down fare in Hangzhou was 10 yuan, plusing 2 yuan per kilometer after the first 3km and 3 yuan per kilometer after 10km. The waiting fee was 2 yuan per five minutes. Passengers need to pay extra 1 yuan as the fuel surcharge.
According to new prices, the flag-down fare is 11 yuan, while passengers pay 2.5 yuan per kilometer after the first 3 kilometers, and 3.75 yuan per kilometer after 10km. The waiting fee is 2.5 yuan per four minutes.
The actual fare is rounded to the nearest yuan, and halfway cases are rounded up. How much more money does it cost to take a taxi if the distance is d kilometers and the waiting time is t minutes.
The original flag-down fare in Hangzhou was 10 yuan, plusing 2 yuan per kilometer after the first 3km and 3 yuan per kilometer after 10km. The waiting fee was 2 yuan per five minutes. Passengers need to pay extra 1 yuan as the fuel surcharge.
According to new prices, the flag-down fare is 11 yuan, while passengers pay 2.5 yuan per kilometer after the first 3 kilometers, and 3.75 yuan per kilometer after 10km. The waiting fee is 2.5 yuan per four minutes.
The actual fare is rounded to the nearest yuan, and halfway cases are rounded up. How much more money does it cost to take a taxi if the distance is d kilometers and the waiting time is t minutes.
Input
There are multipletest cases. The first line of input is an integer T ≈ 10000 indicatingthe number of test cases.
Each test case containstwo integers 1 ≤ d ≤ 1000 and 0 ≤ t ≤ 300.
Each test case containstwo integers 1 ≤ d ≤ 1000 and 0 ≤ t ≤ 300.
Output
For eachtest case, output the answer as an integer.
Sample Input
42 0 5 2 7 311 4
Sample Output
0 1 3 5
#include <stdio.h>#include <stdlib.h>#include <cmath>int main(){ int m,d,t; float s1,s,s2; scanf("%d",&m); while (m--) { s=0; scanf("%d %d",&d,&t); if (d<=3) { s1=11+0.4*t; s2=11+0.625*t; } if(d>3&&d<=10) { s1=11+0.4*t+(d-3)*2; s2=11+0.625*t+(d-3)*2.5; } if(d>10) { s1=11+0.4*t+7*2+(d-10)*3; s2=11+0.625*t+7*2.5+(d-10)*3.75; } int x=s1; if(s1-x>=0.5) x+=1; int y=s2; if (s2-y>=0.5) y+=1; x=abs(x-y); printf("%d\n",x); }return 0;}
- Taxi Fare
- Taxi Fare
- zoj 3600 Taxi Fare
- 4288: Taxi Fare
- ZOJ 3600 Taxi Fare
- ZOJ 3600 Taxi Fare
- Z0J 3600 Taxi Fare
- ZOJ 3600 Taxi Fare
- ZOJ 3600 Taxi Fare
- ZOJ 3600Taxi Fare
- ZOJ3600-Taxi Fare
- zoj 3600 Taxi Fare
- ZOJ 3600 Taxi Fare(模拟)
- ZOJ 3600【Taxi Fare】模拟
- ZOJ 3600Taxi Fare(模拟)
- ZOJ 3600 Taxi Fare【模拟】
- ZOJ 3600 Taxi Fare(数学啊)
- ZOJ Problem Set - 3600||Taxi Fare
- MySQL 5.5.30 发布
- expdp 使用parfile时出现在LRM-00112错误‘user——id不允许多个值'
- 排序问题-《编程珠玑》 ch1 开篇_ 1.6.3
- 【千锋3G 学院】
- 判断字符串是否包含中文的正则表达式
- Taxi Fare
- 牛人给出的编译Linux内核的详细过程
- 百度地图Android sdk开发笔记五修改定位位置的图标
- 内核态文件操作
- 三种嵌入式操作系统的分析与比较
- 限制对比度自适应直方图均衡化算法原理、实现及效果
- .net中AspNetPager的使用方法
- java反射调用某个类的方法(带参或不带参)
- 微软等名企面试题3--字符串专题