联合开发网   搜索   要求与建议
                登陆    注册
排序按匹配   按投票   按下载次数   按上传日期
按分类查找All 控制台编程(23) 

[控制台编程] Max-Multiply

i.最大K乘积问题 问题描述 设I是一个n位十进制整数。如果将I划分为k段,则可得到k个整数。这k个整数的乘积称为I的一个k乘积。试设计一个算法,对于给定的I和k,求出I的最大k乘积。 例如十进制整数 1234 划分为 3 段可有如下情形: 1 × 2 × 34 68 1 × 23 × 4 92 12 × 3 × 4 144 编程任务 对于给定的I 和k,编程计算I 的最大k 乘积。 数据输入 输入的第1 行中有2个正整数n和k。正整数n是序列的长度;正整数k是分割的段数。接下来的一行中是一个n位十进制整数。(n< 10) 结果输出 计算出的最大k乘积。 输入文件示例 输出文件示例 input.txt output.txt 3 2 312 62 实现提示 参考矩阵连乘问题。
That is a difficult problem which i used dynamic ways to solve it. (2017-05-25, Visual C++, 1KB, 下载1次)

http://www.pudn.com/Download/item/id/1495698234435402.html

[控制台编程] medo

设X[ 0 : n - 1]和Y[ 0 : n – 1 ]为两个数组,每个数组中含有n个已排好序的数。找出X和Y的2n个数的中位数。  编程任务 利用分治策略试设计一个O (log n)时间的算法求出这2n个数的中位数。 数据输入 由文件input.txt提供输入数据。文件的第1行中有1个正整数n(n<=200),表示每个数组有n个数。接下来的两行分别是X,Y数组的元素。结果输出 程序运行结束时,将计算出的中位数输出到文件output.txt中
Let X [0: n- 1] and Y [0: n- 1] for the two arrays, each array containing the n number has been sorted. 2n X and Y to identify the number of digits.  programming tasks using the divide and conquer strategy try to design an O (log n) time algorithm to calculate this median number 2n. Data input by the input data provided input.txt file. The first line in the file has a positive integer n (n < = 200), that there are n numbers of each array. The next two lines are the X, Y array elements. The end result is output program runs, the calculated median output to file output.txt (2013-09-07, Visual C++, 1KB, 下载17次)

http://www.pudn.com/Download/item/id/2350065.html

[控制台编程] ferry

某汽车轮渡口,有n辆车要过河。n辆车只有两种要么是客车,要么是货车。已知过江渡船每次能载10辆车,从0分开始每10分钟来一次(即0分一辆,10分一辆,以此类推)。又知上渡船要遵守下述规定:若x分来了一辆渡船所有到大渡口时间<=x分且还没过河的车辆才可能上船,且客车先于货车上船,每上4辆客车必上1辆货车,这时若没有货车就上客车,若没有客车就上货车。试编写一个程序,模拟渡口的管理,统计客车和货车的平均等待时间。 输入格式: 第一行一个正整数n(1000 <= n <= 1000 000),表示要过江的车辆总数。 第二行到n+1行每行两个非负整数type,time(0 <= time <= 1000 000),表示time分到达渡口的车是type类型,type为0表示客车,为1表示货车,时间从0开始计,且按到达时间先后给出数据。 输出格式: 一行两个保留两位的小数(四舍五入)carWaitTime,trunkWaitTime以空格分开,carWaitTime表示客车的平均等待时间,trunkWaitTime表示货车的平均等待时间。
A car ferry port, there are n vehicles to cross the river. n is either the car only two buses, either truck. Known across the river ferry can carry 10 cars each, starting from 0 to once every 10 minutes (ie, 0 a, 10 a, and so on). They know on the ferry to comply with the following requirements: if x points to a car ferry to the large ferry all the time <= x min and it could not cross the river on board the vehicle, and passenger vehicles on board prior to each on the 4 buses will be on a truck, then if there is no vehicle on the bus, if there is no passenger on the truck. Try to write a program to simulate the management of the ferry, bus and truck statistical average waiting time. Input formats: The first line of a positive integer n (1000 <= n <= 1000 000), said the total number of vehicles to cross the river. The second line to the n 1 line per line two non-negative integer type, time (0 <= time <= 1000 000), said the time points to reach the ferry car is of ty (2011-10-27, Visual C++, 2KB, 下载36次)

http://www.pudn.com/Download/item/id/1681349.html
12
总计:23