N (2 <= N <= 8,000) cows have unique brands in the range 1..N. In a spectacular display of poor judgment, they visited the neighborhood 'watering hole' and drank a few too many beers before dinner. When it was time to line up for their evening meal, they did not line up in the required ascending numerical order of their brands.
Regrettably, FJ does not have a way to sort them. Furthermore, he's
not very good at observing problems. Instead of writing down each
cow's brand, he determined a rather silly statistic: For each cow in
line, he knows the number of cows that precede that cow in line that do,
in fact, have smaller brands than that cow.
Given this data, tell FJ the exact ordering of the cows.
题意:给出n头牛前面有多少头比他编号少的数目,求出原来的牛的编号,
#define _CRT_SECURE_NO_WARNINGS
#include
#include
#include
#include
#include