编程介的小学生 2019-02-15 14:20 采纳率: 20.5%
浏览 378

数列级数的极值的计算的一个问题,请问是如何利用C语言的编程代码实现的呢

Problem Description
At present, the university rankings are very popublar.They help senior high school students to choose universities for study.For example,you can find the CHINESE UNIVERSITY RANGKINGS at http://www.netbig.com/.
As we know ,a university ususally has many different departments,such as department of Language(FLS).some of them are quit good when comparing to other universities,but others are not.So,most of universities'rangkings are are composed of several ranking lists, each list for one department.
But here comes a problem that sometimes it's hard to determine which universities is better,when comparing two universities with each othe.Fortunately,Doctor Bob has advanced a new concept named "absolutely better",with which the problem above can be solved.
Now,here is a an example to explain the concept "absolutely better":
Assum that there are three universities (X,Y,Z)and every university has three department:CS,EE and FLS.And the rangkings of the departments are as the followed:
The rankings of the CS:X>Y>Z(X>Y means X has a better CS department than Y)
The rankings of the EE:X>Z>Y
The rankings of the FLS:Z>X>y
Obviously,each each department of University X is better than that of University Y. Then,it's called that X is absolutely better than Y.Using the "absolutely better"concept, it becomes better to compare some paires of Universities.
Now Bob has the complete rangkings of different departments of many universities,and he wants to find k universities(U1,u2,....Uk)such that Ui is absolutely better that Uj(for any i<j).

Input
The first line of the input is a positive integer C.C is the number of test cases
followed.
The first line of each test case is two positive integers N,M(0<N,M<=100),N is the number of the universities and M is the number of departments.And then M lines follow.The i(th)(1<=i<=M)line contains N numbers Ui(1<=i<=N,1<=Ui<=N),indicating the ranking of the i(th)department.If Universitites Ui preceds to University Uj in line k(th department, then the k(th)department do Ui is better than k(th) department of Uj.

Output
The output should consist fo C lines, one lines for each test case.Each line only constains one integer- the maximum values fo k as descriped above.No redundant spaces are needed.

Sample Input
1
3 3
1 2 3
1 3 2
3 1 2

Sample Output
2

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 Qt下使用tcp获取数据的详细操作
    • ¥15 idea右下角设置编码是灰色的
    • ¥15 全志H618ROM新增分区
    • ¥20 jupyter保存图像功能的实现
    • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
    • ¥15 NAO机器人的录音程序保存问题
    • ¥15 C#读写EXCEL文件,不同编译
    • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
    • ¥15 扩散模型sd.webui使用时报错“Nonetype”
    • ¥15 stm32流水灯+呼吸灯+外部中断按键