文件名称:OilingCar
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:192.61kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
acm算法设计
描述:
一辆汽车加满油后可行驶n公里。旅途中有若干个加油站。设计一个有效算法,指出应在哪些加油站停靠加油,使沿途加油次数最少。
对于给定的n和k个加油站位置,编程计算最少加油次数。
输入:
第一行有2 个正整数n和k,表示汽车加满油后可行驶n公里,且旅途中有k个加油站。接下来的1 行中,有k+1 个整数,表示第k个加油站与第
k-1 个加油站之间的距离。第0 个加油站表示出发地,汽车已加满油。第k+1 个加油站表示目的地。
输出:
的最少加油次数。如果无法到达目的地,则输出”No Solution!”。
例输入:
7 7
1 2 3 4 5 1 6 6
例输出:
4-acm algorithm design
Descr iption:
Top up after a car traveling n km. The road there are a number of gas stations. Design an effective algorithm, which should be pointed out that the gas station refueling stop to refuel along the least number.
For a given n and k the location of gas stations, refueling at least the number of computing programming.
Input:
The first line has two positive integers n and k, that the auto top up can be closed n-km journey in k and gas stations. 1 the next line, there are integers k+1, k that the first gas stations with the first
k-1 the distance between gas stations. 0 stations, said first point, the vehicles have top up. Filling the first k+1 that destination.
Output:
At least the number of refueling. If you can not reach their destinations, then output "No Solution!".
Cases of type:
7 7
1 2 3 4 5 1 6 6
Cases the output:
4
描述:
一辆汽车加满油后可行驶n公里。旅途中有若干个加油站。设计一个有效算法,指出应在哪些加油站停靠加油,使沿途加油次数最少。
对于给定的n和k个加油站位置,编程计算最少加油次数。
输入:
第一行有2 个正整数n和k,表示汽车加满油后可行驶n公里,且旅途中有k个加油站。接下来的1 行中,有k+1 个整数,表示第k个加油站与第
k-1 个加油站之间的距离。第0 个加油站表示出发地,汽车已加满油。第k+1 个加油站表示目的地。
输出:
的最少加油次数。如果无法到达目的地,则输出”No Solution!”。
例输入:
7 7
1 2 3 4 5 1 6 6
例输出:
4-acm algorithm design
Descr iption:
Top up after a car traveling n km. The road there are a number of gas stations. Design an effective algorithm, which should be pointed out that the gas station refueling stop to refuel along the least number.
For a given n and k the location of gas stations, refueling at least the number of computing programming.
Input:
The first line has two positive integers n and k, that the auto top up can be closed n-km journey in k and gas stations. 1 the next line, there are integers k+1, k that the first gas stations with the first
k-1 the distance between gas stations. 0 stations, said first point, the vehicles have top up. Filling the first k+1 that destination.
Output:
At least the number of refueling. If you can not reach their destinations, then output "No Solution!".
Cases of type:
7 7
1 2 3 4 5 1 6 6
Cases the output:
4
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Oiling Car/Debug/Oiling Car.exe
Oiling Car/Debug/Oiling Car.ilk
Oiling Car/Debug/Oiling Car.obj
Oiling Car/Debug/Oiling Car.pch
Oiling Car/Debug/Oiling Car.pdb
Oiling Car/Debug/StdAfx.obj
Oiling Car/Debug/vc60.idb
Oiling Car/Debug/vc60.pdb
Oiling Car/Oiling Car.cpp
Oiling Car/Oiling Car.dsp
Oiling Car/Oiling Car.dsw
Oiling Car/Oiling Car.ncb
Oiling Car/Oiling Car.opt
Oiling Car/Oiling Car.plg
Oiling Car/ReadMe.txt
Oiling Car/StdAfx.cpp
Oiling Car/StdAfx.h
Oiling Car/Debug
Oiling Car
Oiling Car/Debug/Oiling Car.ilk
Oiling Car/Debug/Oiling Car.obj
Oiling Car/Debug/Oiling Car.pch
Oiling Car/Debug/Oiling Car.pdb
Oiling Car/Debug/StdAfx.obj
Oiling Car/Debug/vc60.idb
Oiling Car/Debug/vc60.pdb
Oiling Car/Oiling Car.cpp
Oiling Car/Oiling Car.dsp
Oiling Car/Oiling Car.dsw
Oiling Car/Oiling Car.ncb
Oiling Car/Oiling Car.opt
Oiling Car/Oiling Car.plg
Oiling Car/ReadMe.txt
Oiling Car/StdAfx.cpp
Oiling Car/StdAfx.h
Oiling Car/Debug
Oiling Car
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.