标签:main input ane write logs writer put 中国人 中国
2017-07-14 22:44:11
3 5 2 6 1 3 4 0Sample Output
6 vs 0
#include <iostream> #include <algorithm> using namespace std; int main() { int num; while(cin >> num&&num!=0) { int as = 0; int bs = 0; int *a = new int[num]; int *b = new int[num]; for(int i = 0 ; i < num ; i++) { cin >> a[i]; } for(int i = 0 ; i < num ; i++) { cin >> b[i]; } sort(a,a+num); sort(b,b+num); for(int i = 0 ; i < num ; i++) { if(a[i]>b[i]) { as+=2; } else if(a[i]==b[i]) { as+=1; bs+=1; } else if(a[i]<b[i]) { bs+=2; } } cout << as <<" vs "<<bs<<endl; delete a; delete b; } return 0; }
标签:main input ane write logs writer put 中国人 中国
原文地址:http://www.cnblogs.com/ilovelianghui/p/7173020.html