Home > Back-end >  Freshman, learning c language, this problem I...
Freshman, learning c language, this problem I...

Time:02-19

CodePudding user response:

Contrast can be applied to the data is greater than 2

CodePudding user response:

This topic can use greedy algorithm is to, first of all, we just as much as possible to let tian horse horse than king,
At the same time, to ensure the just right tian ma than the king's horse, at the same time to ensure that this horse is tian all the speed is faster than king horse the smallest horse,
So we could start to his king and tian ma is from small to large sorted, the speed of the tian ma traversal, if tian ma king horse, so this horse, then
It is good to both sides of the horse back at the same time,

CodePudding user response:

CodePudding user response:

#include Void pai (int a [], int n); Int main () {int a [1000], [1000] b, Yin; Int c [500]; int m; The scanf (" % d ", & amp; M); for(int j=0; J