123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- //reference: http://blog.csdn.net/u012766950/article/details/38319843
- #include <iostream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- bool compare(int a, int b) {
- return a > b;
- }
- int main() {
- int n = 0, tmp = 0;
- vector<int> tian;
- vector<int> king;
- while (cin >> n&&n) {
- int count = 0;
- for (int i = 0; i < n; i++) {
- cin >> tmp;
- tian.push_back(tmp);
- }
- for (int i = 0; i < n; i++) {
- cin >> tmp;
- king.push_back(tmp);
- }
- sort(tian.begin(), tian.end());
- sort(king.begin(), king.end());
- for (; (tian.size());) {
- int size = tian.size();
- if (tian.at(size - 1) > king.at(size - 1)) {
- count++;
- tian.erase(tian.begin() + size - 1);
- king.erase(king.begin() + size - 1);
- }
- else if (tian.at(size - 1) < king.at(size - 1)) {
- count--;
- tian.erase(tian.begin());
- king.erase(king.begin() + size - 1);
- }
- else if (tian.at(0) > king.at(0)) {
- count++;
- tian.erase(tian.begin());
- king.erase(king.begin());
- }
- else if (tian.at(0) < king.at(0)) {
- count--;
- tian.erase(tian.begin());
- king.erase(king.begin() + size - 1);
- }
- else {
- if (tian.at(0) < king.at(size - 1))
- {
- count--;
- }
- tian.erase(tian.begin());
- king.erase(king.begin() + size - 1);
- }
- }
- cout << 200 * count << endl;
- tian.clear();
- king.clear();
- }
- return 0;
- }
|