2.14 英语翻译打卡

链接:Tian Ji -- The Horse Racing | JXNUOJ

Here is a famous story in Chinese history.
"That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king and others."
"Both of Tian and the king have three horses in different classes, namely, regular, plus, and super. The rule is to have three rounds in a match; each of the horses must be used in one round. The winner of a single round takes two hundred silver dollars from the loser."
"Being the most powerful man in the country, the king has so nice horses that in each class his horse is better than Tian's. As a result, each time the king takes six hundred silver dollars from Tian."
"Tian Ji was not happy about that, until he met Sun Bin, one of the most famous generals in Chinese history. Using a little trick due to Sun, Tian Ji brought home two hundred silver dollars and such a grace in the next match."
"It was a rather simple trick. Using his regular class horse race against the super class from the king, they will certainly lose that round. But then his plus beat the king's regular, and his super beat the king's plus. What a simple trick. And how do you think of Tian Ji, the high ranked official in China?"
田忌赛马。田忌和国王各有三匹马,三匹马的耐力、优劣皆不同。规则是进行三轮比赛:每匹马只能比赛一次。单句获胜者从输的那方得到200元。因为国王权力最大,所以在三种层次的马中,国王的马均比田忌的马好,那么结果可能是国王从田忌那里得到600元。田忌很苦恼,但这时,他遇到了孙膑,孙膑是后来史书上常见的兵法家。田忌听取了孙膑的小计谋,他从家里拿出200元。方法很简单,用田忌的劣马去和国王最好的马比赛,这只会输掉这只会输掉这一轮,然后用最好的马打败国王中马,中等的马打败国王的劣马。这么简单的一个计谋,你是怎样看他的?

Were Tian Ji lives in nowadays, he will certainly laugh at himself. Even more, were he sitting in the ACM contest right now, he may discover that the horse racing problem can be simply viewed as finding the maximum matching in a bipartite graph. Draw Tian's horses on one side, and the king's horses on the other. Whenever one of Tian's horses can beat one from the king, we draw an edge between them, meaning we wish to establish this pair. Then, the problem of winning as many rounds as possible is just to find the maximum matching in this graph. If there are ties, the problem becomes more complicated, he needs to assign weights 0, 1, or -1 to all the possible edges, and find a maximum weighted perfect matching...
However, the horse racing problem is a very special case of bipartite matching. The graph is decided by the speed of the horses --- a vertex of higher speed always beat a vertex of lower speed. In this case, the weighted bipartite matching algorithm is a too advanced tool to deal with the problem.
In this problem, you are asked to write a program to solve this special case of matching problem.

现在,田忌的策略被认为是在图里寻找完美匹配的方法。画田忌的马在一边,国王的马在另一边。只要是田忌的马能打包国王的马,我们在这两只马之间连条线,意思是我们希望这一配对(这两只马比赛)是成立的。接着,尽可能多赢几场比赛仅仅是找到最大匹配(田忌的马必赢)。如果有关系,问题变得复杂了。他需要给所有可能的边指定权重1 -1 0,找到最大加权完美匹配。然而,赛马问题是二部分配中比较特别的一种。这个图形由马的速度决定--速度越高的顶点总是比最低的快。这种情况下,加权二部匹配算法就太先进了。

你需要写一个算法去解决这个特殊问题。

输入:

The input consists of up to 50 test cases. Each case starts with a positive integer n (n <= 1000) on the first line, which is the number of horses on each side. The next n integers on the second line are the speeds of Tian’s horses. Then the next n integers on the third line are the speeds of the king’s horses. The input ends with a line that has a single 0 after the last test case.

输入最多50个测试数据。每组测试数据,第一行输入n,是每边马的数量,接下来一行的n个数字表示田忌的马的速度。第三行的表示国王的马的速度。最后一组输入后,输入0表示结束输入。

输出:

For each input case, output a line containing a single number, which is the maximum money Tian Ji will get, in silver dollars.

对于每组数据,输入单独一行,一个数表示田忌将会赢得最多的钱。以银元为单位。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: smcdraw2.14是一种数字化的绘图软件,它具有各种绘图功能和工具,可以帮助用户轻松进行图形设计和绘制。smcdraw2.14具有简洁易用的界面,适合初学者和专业设计师使用。 首先,smcdraw2.14具有丰富的绘图功能,用户可以使用各种形状和线条工具创建各种图形,如矩形、圆形、箭头等。同时,它还提供了丰富的颜色、线型和填充选项,使用户能够根据自己的需求进行个性化的设计。 其次,smcdraw2.14还具有强大的编辑功能。用户可以调整图形的大小、位置和旋转角度,还可以改变图形的颜色和透明度。此外,smcdraw2.14还提供了各种绘制和编辑工具,如剪切、复制、粘贴、重排等,方便用户对绘图进行修改和操作。 此外,smcdraw2.14还支持导入和导出多种文件格式,用户可以将绘制的图形保存为常见的图像格式,如PNG、JPG等,以便后续使用。同时,用户还可以将已有的图像导入到smcdraw2.14中进行编辑和修改。 最后,smcdraw2.14还具有实用的辅助工具,如标尺和网格线,可以帮助用户更精确地进行绘图。此外,该软件还支持撤销和重做功能,用户可以轻松地回到先前的操作步骤。 总之,smcdraw2.14是一款功能强大、操作简便的数字化绘图软件,它适用于各类用户,无论是初学者还是专业设计师,都可以通过smcdraw2.14实现高质量的绘图和设计。 ### 回答2: smcdraw2.14是一个特定的名词或短语,无法明确其含义和提供具体回答。请提供更多相关信息或背景,以便我可以为您提供更有针对性的答案。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值