题解 | 序列中整数去重
#include <iostream> using namespace std; const int N = 1010; int arr[N]; int main() { int n; cin >> n; int m; for(int i = 0;i < n;i++) { cin >> m; arr[m]++; if(arr[m] <= 1) cout << m << " "; } }
#include <iostream> using namespace std; const int N = 1010; int arr[N]; int main() { int n; cin >> n; int m; for(int i = 0;i < n;i++) { cin >> m; arr[m]++; if(arr[m] <= 1) cout << m << " "; } }
相关推荐