标签:
#include <iostream> #include <string> #include <sstream> #include <cstring> using namespace std; const int Max = 100010; int a[Max]; int main() { int n; int mini = 9999999; int maxi = 0; cin >> n; cin.get(); //输入带空格的字符串之前要注意吸收多余换行符 string s; memset(a,0,sizeof(a)); while(n--) { getline(cin,s); stringstream ss(s); int x; while(ss>>x) { if(x < mini) mini = x; if(x > maxi) maxi = x; a[x] ++; } } for(int i = mini; i <= maxi; i++) if(a[i] == 0) cout << i << ‘ ‘; else if(a[i] == 2) cout << i << endl; system("pause"); return 0; }
标签:
原文地址:http://www.cnblogs.com/ekinzhang/p/4391199.html