Tên đăng nhập Điểm ▾ Bài tập Giới thiệu
11901 1888 19
11902 1888 11
11903 1888 4
11904 1887 3
11905 1887 18
11906 1887 5
11907 1887 2
11907 1887 2
11907 1887 2
11907 1887 2
11907 1887 2
11907 1887 2
11907 1887 2
11907
raskel 1817
Trần Văn Tấn Khôi, Bình Phước
1887 2
11907 1887 2
11916 1887 15
11917 1886 6
11918 1886 4
11919 1886 2
11920 1885 4
11921 1885 7
11922 1885 7
11923 1884 9

here

11923 1884 7
11925
ngochien02071974
Trần Ngọc Hiển
1884 13
11926 1883 10
11927 1883 3
11928 1883 18
11929 1883 5

include<bits/stdc++.h>

using namespace std;
int main(){
int n,k,dem=1;
cin>> n>>k;
int a[999];
for(int i=0;i<n;i++){ cin >> a[i];
}
sort(a,a+n);
if(a[n-1]>=k)
dem+=abs(a[n-1]-k);
//a.pop_back();
for(int i=0;i<n-1;i++){
dem+=a[i];
}
cout << dem;
return 0;
}

11930
Mina_1108
Nguyễn Hoàng My
1882 7

Blackpink in your area
Fan cuong Blackpinkk

11931 1882 10
11932 1882 2
11933 1882 15
11933 1882 15
11933
quynhanh13022014
Hoang Truong Quynh Anh
1882 15

Xin chào mọi người (☞゚ヮ゚)☞☜(゚ヮ゚☜)

11933 1882 15
11933 1882 15
11933 1882 15
11939 1882 17
11940 1881 2
11941 1881 2
11942 1880 5
11943
nhatminh2816 1012
Đặng Vũ Nhật Minh
1880 3
11944 1880 13
11945 1879 17
11945 1879 17
11945 1879 17
11945
tkanhdinhquoc
Đinh Quốc Anh - LDO
1879 17
11945 1879 17
11945 1879 17
11945 1879 17
11945
PY1ENguyenTanThanh
Nguyễn Tấn Thành
1879 17
11945
vinh1372004
Duong Vinh
1879 17
11945 1879 17
11945 1879 17
11945 1879 17
11945 1879 17
11945
codepython15
Trần Khải Lâm
1879 17

Để thắng cuộc, bạn cần cả kỹ năng và ý chí. – Frank Tyger!

11945 1879 17
11945
Hoxuanhung2802
Hồ Xuân Hùng
1879 17
11945
dzcojsai1234
Dũng Trầnnn
1879 17
11945 1879 17

‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌

11963 1878 15
11964 1878 6
11965 1878 5
11966 1877 5
11967 1877 6
11968 1876 7
11969
Lê_Phước_Thắng
Lê_Phước_Thắng_LớpA1
1876 49
11970 1875 4
11971 1874 4
11971 1873 3

include <iostream>

include <math.h>

include <algorithm>

include <climits>

include <queue>

include <vector>

include <stack>

include <string>

include <iomanip>

include <tuple>

include <set>

include <map>

using namespace std;

define int long long

const int MAXN = 300005;
int a[MAXN];
int s;
int n;

void solve(){
cin >> n >> s;
for(int i = 1 ; i <= n ;i++){
cin >> a[i];
}
int i = 1;
int j = n ;
while(i <= j){
if(a[i] + a[j] < s){
i++;
}else if(a[i] + a[j] > s){
j--;
}else if(a[i]+a[j] == s){
cout << i << " " << j << endl;
return;
}
}
cout << "No solution" << endl;
return;

}

signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int t=1;
// cin >> t;
while(t--){
solve();
}
return 0;
}

11973 1872 15
11974 1872 19
11975 1872 3

11976 1872 15
11977 1870 11
11978 1870 16
11979 1870 7
11980 1870 13
11980
STRB03Triet
Phan Đình Triết
1867 10
11982 1867 8
11983 1866 3

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import random

def is_prime(n, k=5):
if n <= 1:
return False
if n == 2 or n == 3:
return True
if n % 2 == 0:
return False

for i in range(k):
    a = random.randint(2, n-1)
    if pow(a, n-1, n) != 1:
        return False

return True
11984 1866 8
11985 1865 6
11986 1865 8
11987 1865 7
11988 1863 3
11989 1862 2
11990 1862 2
11991
NHU42 1397
Bùi Hữu Nhật Minh
1861 4

Always be yourself, express yourself, have faith in yourself, and do not go out and look for a successful personality and duplicate it.

11992 1861 3
11993 1861 9
11994 1861 2
11994 1860 4
11996
thongvinh2
Phan Điền Vĩnh Thông
1860 13
11997 1859 13
11998 1859 17
11999 1858 12
12000 1857 11