判断Linux中的发行版本号的算法,怎么采用C语言程序代码设计思想的实现呢?

Problem Description
Samuel is fed up with Microsoft Windows system. Instead of xp he chose to install Linux Fedora 10 in his own desktop. But Linux has various distributions with different kernel versions. Some kernels are not stable. Of course,the unstable ones is not of Samuel's choice. Samuel is never tired of reinstalling Linux,because he always wants to try the latest release version on his computer. So Samuel needs to know the kernel's version before he downloads the distribution version.
Here is an easy problem for you,tell Samuel which distribution he should choose to reinstall.
To make the problem easier,suppose each Linux kernel version mark is made up by a string like the format:”r.x.y”Here r represents the major version number,x will be even(stable) or odd(beta version not stable,need to be developed),y represents the time the kernel has been corrected. For instance,the kernel whose number is 2.6.7 is a stable version. However,2.5.11 is not due to the number the letter x represents is odd.
As for he problem which one is the latest kernel,you can also refer to version number. When compared two version,you should first compare the r1 and r2, if r1>r2 version 1 is the latest version. If r1=r2,you need to compare x1 and x2,if x1>x2 that means the version 1 is the latest. If x1=x2,then you need to compare y1 and y2,version 1 is the newest one only if y1>y2..Not clear about my English explanation,you can see the HDOJ 1976,it has a Chinese one.

Input
The input will consist 2 major parts:
Test cases t.
Each of test case is made up of 2 minor parts:
1.The number of available distributions
2.Name of the distribution(a string,no white blanks)
3.The kernel version(also a string in the format r.x.y without any blanks)
I guarantee there is no test case has the same distribution name but with different kernel version nor the same kernel version but with the different distribution name. All the information in the same test cases is totally different.

Output
Your task is to tell the latest version apart,and output the name of the distribution,using “The latest distribution Samuel will choose is ****.”

Sample Input
2
3
SUSE 2.6.5
Fedora 2.6.7
Ubuntu 2.6.6
4
RedFlag 2.4.5
CentOS 2.5.6
Fedora 2.4.3
Debian 2.5.7
(In reality,the kernel version may not be so. The numbers are made up by myself.)

Sample Output
The latest distribution Samuel will choose is Fedora.
The latest distribution Samuel will choose is RedFlag.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问

相似问题

1
C语言数据结构的模拟银行存钱取钱的算法,采用C语言程序的编写
1
数据结构上的一个线性表的冲突的解决,是不是用哈希算法怎么采用C语言的实现方式
0
纸牌牌面正反的判断问题的算法,怎么采用C语言程序设计的办法来实现的
0
金币在篮子当中的分装的问题的算法,采用C语言程序的编写过程实现
0
可编码的数据的重新分配N的算法,采用C语言的程序设计语言的编写
0
一个追击应用问题,计算移动的时间算法,采用C语言程序设计的办法来实现怎么做
0
数组的矩阵的转移的算法,怎么采用C语言的程序的计算的方式来实现的
0
六位数字的编码的一个日期的算法,采用C语言的程序的设计的过程的做法
0
反推递增数列的一个算法的思路问题,怎么采用C语言的程序的设计的思想实现?
0
数组的平均切分的一个算法,怎么采用C语言的程序的编写的过程的方式怎么实现?
0
几何图形的碰撞的一个判断的算法,怎么采用C语言的程序的代码的编写的思路去实现的呢?
0
相似性的判断算法,输出相似性判定,怎么采用C语言的程序的代码编写的方式来实现的
0
俄罗斯方块是否能够填充的判断的一个算法,怎么采用C语言的程序编程的过程来实现的呢?
0
锁的开闭的判断的问题的算法,怎么采用C语言程序代码的编写的技术实现的?
0
简化了的星图的一个算法问题,怎么采用C语言程序编写的思路的代码实现的?
0
出名的程度的判断分析的算法,利用C语言的代码程序编写的方式如何才能实现的?
0
用字符串来表示的等式的问题的算法,采用C语言程序设计语言编写程序代码的思路做法
0
按照字母的顺序排列字符串的算法,怎么采用C语言程序代码编写的步骤去实现?
0
一个寻宝图寻找问题的算法模拟的实现,怎么采用C语言程序编写的思维用程序解决的
0
求出最佳序列的一个问题算法,怎么采用C语言程序代码编写机制去实现的呢?