#include <iostream>
using namespace std;
int main()
{
int n, S, i, j;
cin >> n >> S;
int A[n];
for (i = 0; i < n; i++) cin >> A[i];
for (i = 0; i < n - 1; i ++)
for (j = 0; j < n - i - 1; j++)
if (A[j] > A[j + 1]) swap(A[j], A[j + 1]);
j = 0; i = 0;
while ((j < S) && (i < n)) {
j = j + A[i];
i = i + 1;
}
if (j <= S) cout << i;
else cout << i - 1;
return 0;
}
const fi=’bai.inp’;
fo=’bai.out’;
maxn=round(1e9)+5;
var n,s:longint;
a,dem: array [1..maxn] of longint;
procedure nhap;
var i:longint;
begin
assign(input,fi);
reset(input);
readln(n,s);
for i:=1 to n do
readln(a[i]);
close(input);
end;
type
tlist = array[1..max] of longint;
procedure qsortAB(var a,b : tlist);
procedure sort(l,r: longint);
var
i,j,x,y: longint;
begin
i:=l;
j:=r;
x:=a[(l+r) div 2];
while(i<=j) do
begin
while a[i]<x do
inc(i);
while x<a[j] do
dec(j);
if not(i>j) then
begin
// hoan vi a[i] a[j]
y:=a[i]; a[i]:=a[j]; a[j]:=y;
// hoan vi b[i] b[j]
y:=b[i]; b[i]:=b[j]; b[j]:=y;
inc(i);
j:=j-1;
end;
end;
if l<j then
sort(l,j);
if i<r then
sort(i,r);
end;
begin
sort(1,max);
end;
procedure xuly;
var c:longint;
begin
while c<s do
for i:=1 to n do
if a[i]>s then c:= c+a[i]; inc(dem[i]);
end;
procedure xuat;
begin
assign(output,fo);
rewrite(output);
for i:=1 to n do
if dem[i] :=1 then write a[i]:
close(output);
end;
begin
nhap;
xuly;
xuat;
end.
đây nha bạn
Tin học, tiếng Anh: informatics, tiếng Pháp: informatique, là một ngành khoa học chuyên nghiên cứu quá trình tự động hóa việc tổ chức, lưu trữ, xử lý và truyền dẫn thông tin của một hệ thống máy tính cụ thể hoặc trừu tượng (ảo). Với cách hiểu hiện nay, tin học bao hàm tất cả các nghiên cứu và kỹ thuật có liên quan đến việc mô phỏng, biến đổi và tái tạo thông tin.
Nguồn : Wikipedia - Bách khoa toàn thưLớp 8 - Năm thứ ba ở cấp trung học cơ sở, học tập bắt đầu nặng dần, sang năm lại là năm cuối cấp áp lực lớn dần nhưng các em vẫn phải chú ý sức khỏe nhé!
Nguồn : ADMIN :))Copyright © 2021 HOCTAP247