为什么是WA

tctm169 我以逍遥醉人间 2024-09-15 20:13:12 4

#include <bits/stdc++.h> #include #include #include #include #include #include using namespace std; int main() { int n; cin >> n; int a[20005]; int sum = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; sum++; } sort(a + 1, a + 1 + n); for (int i = 1; i <= n; i++) { if (a[i] == a[i + 1]) { sum--; continue; } } for (int i = 1; i <= n; i++) { if (a[i] == a[i + 1]) { continue; } else { cout << a[i] << " "; } } return 0; }

{{ vote && vote.total.up }}

共 1 条回复

root 站长

不能排序,这个题目是要输出按照输入的顺序。