# 发奖金问题

过年了，村里要庆祝。村长说，村里有一笔钱作为奖金，让每个人写一个纸条上来，谁写的数目与奖金最接近，就算猜中，这笔奖金就归谁，如果多人猜中，则平分。编写程序，算算都有哪些人得到奖金？多少？

## template

```java
import java.util.Collections;
import java.util.Comparator;
import java.util.Arrays;
class Q707984 {
	public static void main(String[] args) {
		int award = 100;
		String[] people = { "a", "b", "c", "d", "e", "f", "g", "h" };
		Integer[] guess = { 75, 70, 80, 120, 100, 110, 100, 45 };
		Integer[] ordered = new Integer[people.length];
		for (int i = 0; i < ordered.length; i++)
			ordered[i] = i;
		Arrays.sort(ordered, new Comparator<Integer>() {
			@Override
			public int compare(Integer a, Integer b) {
				int x = guess[a] - award > 0 ? guess[a] - award : award - guess[a];
				int y = guess[b] - award > 0 ? guess[b] - award : award - guess[b];
				return x - y;
			}
		});
		int maxp = 0;
		int i = 0;
		while (guess[ordered[i++]] == award)
			maxp++;
		if (maxp <= 1)
			System.out.println(people[ordered[0]] + "一人得奖" + award + "元。");
		else {
			for (i = 0; i < maxp; i++)
				System.out.print(people[ordered[i]] + " ");
			System.out.println("共同得奖" + award / (float) (maxp) + "元。");
		}
	}
}
```

## 答案

```java

```

## 选项

### A

```java

```

### B

```java

```

### C

```java

```