arrow_forward همه ارسال‌ها

جزئیات ارسال کد#497

code_blocks
مسئله مربوطه: دنیز و صف مدرسه (#25) arrow_outward
verified
وضعیت داوری نهایی: پذیرفته شد
terminal
زبان برنامه‌نویسی: C++
schedule
ارسال‌کننده و زمان:
melisa azadi (۲ سال پیش)
descriptionsolution.cpp ۲۷ خط • ۳۸۱ بایت
1#include <iostream>
2#include <string>
3#include <algorithm>
4
5using namespace std;
6
7int main()
8{
9 int n, x;
10 cin >> n >> x;
11
12 int arr[n + 1];
13
14 for (int i = 0 ; i < n ; i++ ){
15 cin >> arr[i];
16 }
17
18 arr[n] = x;
19
20 sort(arr, arr + n + 1);
21
22 for (int i = 0 ; i < n + 1 ; i++ ){
23 cout << arr[i] << " ";
24 }
25
26 return 0;
27}
کد ارسال‌شده برای داوری خودکار هاتکدز UTF-8