标签:ace 整数 之间 esc while ++ return 市场 个人
http://acm.hdu.edu.cn/showproblem.php?pid=2109
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int a[maxn], b[maxn]; int cmpscore(int num1, int num2) { if(num1 > num2) return 2; else if(num1 == num2) return 1; else return 0; } int cmppscore(int num1, int num2) { if(cmpscore(num1, num2) == 2) return 0; else if(cmpscore(num1, num2) == 1) return 1; else return 2; } int main() { int n; while(~scanf("%d", &n)) { if(n == 0) break; for(int i = 1; i <= n; i ++) scanf("%d", &a[i]); for(int i = 1; i <= n; i ++) scanf("%d", &b[i]); sort(a + 1, a + 1 + n); sort(b + 1, b + 1 + n); int sum1 = 0, sum2 = 0; for(int i = 1; i <= n; i ++) { sum1 += cmpscore(a[i], b[i]); sum2 += cmppscore(a[i], b[i]); } printf("%d vs %d\n", sum1, sum2); } return 0; }
标签:ace 整数 之间 esc while ++ return 市场 个人
原文地址:https://www.cnblogs.com/zlrrrr/p/9410845.html