const
fin='taxi.inp'; fon='taxi.out';
maxm=1000;vc=100;
var
d:array[1..4] of longint;
n:word;
procedure enter;
var i,x:word;
begin
readln(n);
for i:=1 to n do
begin
read(x);
inc(d[x]);
end;
end;
procedure solve;
var s:word;
begin
s:=0;
s:=d[4];
s:=s+d[3];
d[1]:=d[1]-d[3];
s:=s+(d[2] div 2);
if d[2] mod 2 = 1 then
begin
inc(s);
d[1]:=d[1]-2;
end;
if d[1]>0 then s:=s+((d[1]-1) div 4)+1;
write(s);
end;
begin
assign(input,fin);reset(input);
assign(output,fon);rewrite(output);
enter;
solve;
close(input);close(output);
end.
* Chuyên dạy lập trình ONLINE cho học sinh THCS, THPT *.
Mọi giao lưu, trao đổi, xin liên hệ: Lê Quang Vinh - zalo: 037.803.8755.
Page: Lớp học Code Sky
Group FB1: Ôn thi HSG9 - THTB - TS10 chuyên tin
Group FB2: Học Scratch - Ôn thi Tin học trẻ bảng A
Thứ Ba, 3 tháng 5, 2022
TAXI PAS
Đăng ký:
Đăng Nhận xét (Atom)
Không có nhận xét nào:
Đăng nhận xét
Lưu ý: Chỉ thành viên của blog này mới được đăng nhận xét.