arrow_forward
همه ارسالها
جزئیات ارسال کد#459
برای پسندیدن وارد شوید
1#include <iostream>
2#include <vector>
3using namespace std;
4
5int main()
6{
7 int n;
8 cin >> n;
9
10 vector<int> arr;
11 for (int i = 0; i < n; i++)
12 {
13 int x;
14 cin >> x;
15 if (x != 0)
16 arr.push_back(x);
17 }
18
19 int res = n - arr.size();
20
21 for (int i = 0; i < res; i++)
22 arr.push_back(0);
23
24 for (int i = 0; i < n; i++)
25 {
26 cout << arr[i] << " ";
27 }
28
29 return 0;
30}
کد ارسالشده برای داوری خودکار هاتکدز
UTF-8