ZCMU—1871
来源:互联网 发布:php时间戳转换成时间 编辑:程序博客网 时间:2024/05/18 05:11
Problem C: Problem C: Snow Clearing
Time Limit: 1 Sec Memory Limit: 128 MB[Submit][Status][Web Board]
Description
Problem C: Snow Clearing
As the days become shorter and the nights become longer we turn our thoughts to snow clearing. Due to budget cuts, the Big Noisy City has exactly one snow plow. The plow can clear exactly one lane of a road in a single pass. Whenever there is snow on the ground, the plow departs from its hangar and tours the city, plowing as it goes. What is the minimum time that the plow needs to clear every lane of every road?
The first line of input contains two integers: the x,y coordinates of the hangar (in metres). Up to 100 lines follow. Each gives the coordinates (in metres) of the beginning and end of a street. All roads are perfectly straight, with one lane in each direction. The plow can turn any direction (including a U-turn) at any intersection, and can turn around at the end of any street. The plow travels at 20 km/h if it is plowing, and 50 km/h if the lane it is driving on has already been plowed. It is possible to reach all streets from the hangar.
Your output should be the time, in hours and minutes, required to clear the streets and return to the hangar. Round to the nearest minute.
Input
Output
Sample Input
Sample Output
【分析】
#include <stdio.h>#include <math.h> main(){ int x,y; while (~scanf("%d%d",&x,&y)) { int a,b; double ans=0; while (~scanf("%d%d%d%d",&a,&b,&x,&y)) ans+=sqrt((x-a)*(x-a)+(y-b)*(y-b)); ans/=1000; ans*=6; ans+=0.5; int t=(int)ans; printf("%d:%02d\n",t/60,t%60); } return 0; }
- ZCMU—1871
- ZCMU—1678
- ZCMU—1605
- ZCMU—1067
- ZCMU—1607
- ZCMU—1069
- ZCMU—1611
- ZCMU—1606
- ZCMU—1774
- ZCMU—1766
- ZCMU—1752
- ZCMU—1724
- ZCMU—1623
- ZCMU—1689
- ZCMU—1667
- ZCMU—1639
- ZCMU—1668
- ZCMU—1540
- Quartz 起步
- USACO 3.4解题报告
- 一个简单的进度条
- java中的Integer和Long值类型问题
- 快牙网传——轻松传文件
- ZCMU—1871
- 医学成像技术简介(CT,MRI等)及相关论坛、技术应用链接
- 架构之路之spring+redis的集成
- sse转neon
- 一行代码解决各种IE兼容问题,IE6,IE7,IE8,IE9,IE10
- C++ STL的迭代器(iterator)
- 16. 3Sum Closest
- Android 的回调机制
- 算法训练 Anagrams问题(字符串操作)