Demo
所属分类:Windows编程
开发工具:Unix_Linux
文件大小:1KB
下载次数:2
上传日期:2014-09-17 23:30:02
上 传 者:
nameqiaohe
说明: 号码分配过程中,用如下格式表示已经分配的号码:a1-b1,a2-b2, ... ,ai-bi, ... ,an-bn,其中ai-bi表示一段连续号码,ai代表起始号码,bi代表结束号码,简称号码段。
例如:
12-30,40-50,100-200
表示12到30号,40到50号,100到200号已经分配。
号码段之间用“,”分隔,号码段起止号码用“-”连接。
给定字符串s1,代表已经分配的号码,格式如上;
s2代表将要分配的号码,格式为a1-b1,即一个号码段。
编写程序给出最后分配的结果s3。
举例如下:
s1= 10-20,30-50
s2= 22-25
则s3= 10-20,22-25,30-50 。号码段22-25按顺序插入到了“10-20,30-50”之间。
编写中注意号码段合并问题,例如:
s1= 1-3,8-20
s2= 4-7
则s3不能等于 1-3,4-7,8-20 ,而是要将号码段进行合并。
合并后的结果应当是
s3= 1-20
(Number allocation process, using the following format has been assigned number: a1-b1, a2-b2, ..., ai-bi, ..., an-bn, where ai-bi expresses a sequential number, ai representatives from starting number, bi representative ending number, referred to paragraph numbers.
For example:
12-30,40-50,100-200
Said to the 30th 12, 40-50 number, 100-200 number has been assigned.
Between the number of segments with , separated, the beginning and ending number with the number of segments - connections.
S1 given string, representing the number has been assigned, the format above
s2 representative will be assigned numbers in the format a1-b1, that a number of segments.
The results given in the last programming assignment s3.
Examples are as follows:
s1 = 10-20,30-50
s2 = 22-25
The s3 = 10-20,22-25,30-50 . No segment 22-25 sequentially inserted into the 10-20,30-50 between.
Write the note numbers merger section, for example:
s1 = 1-3,8-20
s2 = 4-7
S3 is not e)
文件列表:
Demo.c (2245, 2014-09-17)
近期下载者:
相关文件:
收藏者: