vuachepcode
@vuachepcode
Hiệu năng
13,94
#178
Đã giải
5
Các kỳ thi đang tham gia
0/ 3
Đóng góp
0
🌹
Rose
11#1528
🌻
Sunflower
12#178
§ giới thiệu
Thông tin
include<bits/stdc++.h>
using namespace std;
define ll long long
ll n,k,tong=0,a[1000005]; int main() { iosbase::syncwith_stdio(false); cin.tie(nullptr);
cin>>n;
cin>>k;
for(ll i=1;i<=n;i++)
{
cin>>a[i];
}
sort(a+1,a+n+1);
for(ll i=1;i<=k;i++)
{
tong+=a[i];
}
cout<<tong;
}