编程介的小学生 2019-08-12 21:57 采纳率: 20.5%
浏览 186

C语言,用5个数字连起来的计算

Problem Description
Each member of WHU ACM Team developed his/her own Five in a row AI application. They are planning to hold an AI competition on the online arena they just developed.
Each AI competitor has to compete with every other participator once. The winner of each game is awarded with credits while the loser gets nothing. No one gets credits in a tied game.

Every competitor has an experience point, which is crucial to the game. In each game, the competitor with higher experience point wins, except for tied games, in which two competitors have the same experience point.

Those AIs are so clever that they will learn from every game. That is to say, no matter win or lose, AIs' experience point may increase after each game.

Alex, the team leader, has the privilege to arrange the game order. He wants to maximum his credit. Please help him solve the problem.

Input
The input consists of several test cases. The first line of the input consists of an integer T, indicating the number of test cases.
Each test case starts with a line consist of an integer N, indicating the number of competitors. Each of the following N lines consists of N integers Eij, indicating the experience point the i-th competitor will increase after the game with the j-th competitor. Then, each of the following N lines consists of N integers Wij, indicating the credit the i-th competitor will gain if wins the game with the j-th competitor.

The last line of each test case consists of N integers Si, indicating the initial experience point of each competitor.

By the way, Alex is the first player.
Technical Specification

  1. 1 ≤ T ≤ 11
  2. 1 ≤ N ≤ 13
  3. 0 ≤ Wij ≤ 10
  4. 0 ≤ Eij, Si ≤ 1000

Output
For each test case, output a single line consists of the maximum credit Alex may get.

Sample Input
2
2
0 1
1 0
0 1
1 0
1 1
3
0 5 2
0 0 0
0 0 0
0 10 1
1 0 1
1 0 0
1 10 5

Sample Output
0
1

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 C#调用python代码(python带有库)
    • ¥15 矩阵加法的规则是两个矩阵中对应位置的数的绝对值进行加和
    • ¥15 活动选择题。最多可以参加几个项目?
    • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
    • ¥15 vs2019中数据导出问题
    • ¥20 云服务Linux系统TCP-MSS值修改?
    • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
    • ¥20 怎么在stm32门禁成品上增加查询记录功能
    • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面
    • ¥50 NT4.0系统 STOP:0X0000007B