Hệ sinh thái số IELP
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.

Hệ sinh thái số IELP

Học lập trình với Hệ sinh thái số IELP
 
Trang ChínhTrang Chính  CalendarCalendar  Latest imagesLatest images  Trợ giúpTrợ giúp  Tìm kiếmTìm kiếm  Thành viênThành viên  NhómNhóm  Đăng kýĐăng ký  Đăng NhậpĐăng Nhập  
Tìm kiếm
 
 

Display results as :
 
Rechercher Advanced Search
Keywords
chứa nhật được nguyễn điểm sach Hoàng HOAI Phạm sinh Minh wavio thưởng Phần BANG tổng giác đặng pháp Nhàn tích Trần hình phương Thành 2022
Latest topics
» Buổi học số 1. Cấu trúc tuần tự trong C++ (Bài 1 -> Bài 15)
Nguyễn Phúc Tâm EmptyThu Apr 25, 2024 10:49 am by quanle1120

» Chấm bài trực tuyến với Jusolan.ddns.net
Nguyễn Phúc Tâm EmptyWed Apr 24, 2024 9:15 pm by Admin

» Bài kiểm tra giữa Học kỳ II
Nguyễn Phúc Tâm EmptyWed Apr 05, 2023 8:00 am by Nguyễn Đức Mạnh

» Bài giữa kì 2
Nguyễn Phúc Tâm EmptyMon Apr 03, 2023 8:34 am by Khách viếng thăm

» Bài giữa kì tin Lê Đức Anh
Nguyễn Phúc Tâm EmptySun Apr 02, 2023 8:33 pm by Tendalda06

» Nghiêm Tuấn Tú
Nguyễn Phúc Tâm EmptySat Apr 01, 2023 9:03 am by Nghiêm Tuấn Tú

» Nguyễn Trần Ý Nhi
Nguyễn Phúc Tâm EmptySat Apr 01, 2023 8:23 am by Nguyễn Trần Ý Nhi

» Nguyễn Kim Anh
Nguyễn Phúc Tâm EmptySat Apr 01, 2023 12:05 am by Khách viếng thăm

» Trần Thanh Trà
Nguyễn Phúc Tâm EmptyFri Mar 31, 2023 11:10 pm by Trần Thanh Trà

May 2024
MonTueWedThuFriSatSun
  12345
6789101112
13141516171819
20212223242526
2728293031  
CalendarCalendar
Top posting users this week
No user

 

 Nguyễn Phúc Tâm

Go down 
2 posters
Chuyển đến trang : 1, 2  Next
Tác giảThông điệp
Admin
Admin



Tổng số bài gửi : 152
Join date : 23/04/2022
Age : 41
Đến từ : THPT Chuyên Nguyễn Tất Thành - Yên Bái

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptySun Jul 03, 2022 8:11 pm

Nơi nộp bài của Nguyễn Phúc Tâm
Về Đầu Trang Go down
https://ielp.forumvi.com
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyTue Aug 09, 2022 8:23 pm

var
i, j, n: longint;
a: array[-7..100007] of longint;
procedure xuli();
var d: longint;
begin
d := 0;
for i := 1 to n do
begin
if a[i] = 0 then inc(d);
if 2*d > n then exit;
end;
if 2*d = n then
begin
for i := 1 to n do write(a[i],#32);
writeln();
end;
end;
procedure sinh();
var i, j: longint;
begin
for i := 1 to n do a[i] := 0;
i := n;
while i > 0 do
begin
xuli();
i := n;
while a[i] = 1 do dec(i);
a[i] := 1;
for j := i + 1 to n do a[j] := 0;
end;
end;
begin
assign(input,'ppsinh.inp');reset(input);
assign(output,'ppsinh.out');rewrite(output);
readln(n);
if n mod 2 <> 0 then writeln(-1)
else sinh;
close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyTue Aug 09, 2022 8:47 pm

var
i, j, n: longint;
a: array[-7..100007] of longint;
procedure xuli();
var p: longint;
begin
p := 1;
for i := 1 to n do
if a[i] + a[i+1] + a[i+2] = 3 then
begin
p := 0;
exit;
end;
if p = 1 then
begin
for i := 1 to n do write(a[i],#32);
writeln();
end;
end;
procedure sinh();
var i, j: longint;
begin
for i := 1 to n do a[i] := 0;
i := n;
while i > 0 do
begin
xuli();
i := n;
while a[i] = 1 do dec(i);
a[i] := 1;
for j := i + 1 to n do a[j] := 0;
end;
end;
begin
assign(input,'ppsinh.inp');reset(input);
assign(output,'ppsinh.out');rewrite(output);
readln(n);
sinh;
close(input);close(output);
end.


Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyTue Aug 09, 2022 8:51 pm

var
 i, j, n, k: longint;
 a: array[-7..100007] of longint;
procedure xuli();
var d: longint;
begin
   d := 0;
   for i := 1 to n do
     if a[i] = 1 then inc(d);
   if d = k then
     begin
         for i := 1 to n do write(a[i],#32);
         writeln();
     end;
end;
procedure sinh();
var i, j: longint;
begin
   for i := 1 to n do a[i] := 0;
   i := n;
   while i > 0 do
     begin
         xuli();
         i := n;
         while a[i] = 1 do dec(i);
         a[i] := 1;
         for j := i + 1 to n do a[j] := 0;
     end;
end;
begin
   assign(input,'ppsinh.inp');reset(input);
   assign(output,'ppsinh.out');rewrite(output);
   readln(n, k);
   sinh;
   close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyTue Aug 09, 2022 9:06 pm

var
i, j, n, k, p: longint;
a: array[-7..100007] of longint;
procedure xuli();
var d: longint;
begin
d := 0;
for i := 1 to n do
begin
if a[i] = 1 then inc(d);
if d > k then exit;
end;
if d <= k then
begin
p := 1;
for i := 1 to n do write(a[i],#32);
writeln();
end;
end;
procedure sinh();
var i, j: longint;
begin
for i := 1 to n do a[i] := 0;
i := n;
while i > 0 do
begin
xuli();
i := n;
while a[i] = 1 do dec(i);
a[i] := 1;
for j := i + 1 to n do a[j] := 0;
end;
end;
begin
assign(input,'ppsinh.inp');reset(input);
assign(output,'ppsinh.out');rewrite(output);
readln(n, k);
p := 0;
sinh;
if p = 0 then writeln(-1);
close(input);close(output);
end.


Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyThu Aug 11, 2022 9:27 am

// DQBN7
uses math;
var
 i, j, n, s: longint;
 a, b: array[-7..100007] of longint;
procedure xuli();
var s1, s0, p1, p2: longint;
begin
   s1 := 0;s0 := 0;p1 := 1;p2 := 1;
   for i := 1 to n do
     if b[i] = 1 then
       begin
           s1 := s1 + a[i];
           if s1 * 2 > s then exit;
       end
     else
       begin
           s0 := s0 + a[i];
           if s0 * 2 > s then exit;
       end;
   if s0 = s1 then
     begin
         for i := 1 to n do
           if b[i] = 1 then write(i,#32);
         writeln;
         for i := 1 to n do
           if b[i] = 0 then write(i,#32);
         writeln;
     end;
end;
procedure sinh();
var i, j: longint;
begin
   for i := 1 to n do b[i] := 0;
   i := n;
   while i > 0 do
     begin
         xuli();
         i := n;
         while b[i] = 1 do dec(i);
         b[i] := 1;
         for j := i + 1 to n do b[j] := 0;
     end;
end;
begin
   assign(input,'dqbn07.inp');reset(input);
   assign(output,'dqbn07.out');rewrite(output);
   readln(n);
   s := 0;
   for i := 1 to n do
     begin
         read(a[i]);
         s := s + a[i];
     end;
   sinh;
   close(input);close(output);
end.


Được sửa bởi Nguyễn Phúc Tâm ngày Thu Aug 11, 2022 2:40 pm; sửa lần 1.
Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyThu Aug 11, 2022 9:28 am

// DQBN8
uses math;
var
i, j, n, k, rmax: longint;
a, b, c: array[-7..100007] of longint;
procedure xuli1();
var s, d: longint;
begin
s := 0;d := 0;
for i := 1 to n do
if b[i] = 1 then
begin
inc(d);
s := s + a[i];
end;
if (s mod k = 0) and (d > rmax) then rmax := d;
end;
procedure sinh1();
var i, j: longint;
begin
for i := 1 to n do b[i] := 0;
i := n;
while i > 0 do
begin
xuli1();
i := n;
while b[i] = 1 do dec(i);
b[i] := 1;
for j := i + 1 to n do b[j] := 0;
end;
end;
procedure xuli2();
var s, d, p: longint;
begin
s := 0;d := 0;
for i := 1 to n do
if b[i] = 1 then
begin
inc(d);
s := s + a[i];
end;
if (s mod k = 0) and (d = rmax) then
begin
for p := 1 to n do
if b[p] = 1 then write(p,#32);
writeln();
end;
end;
procedure sinh2();
var i, j: longint;
begin
for i := 1 to n do b[i] := 0;
i := n;
while i > 0 do
begin
xuli2();
i := n;
while b[i] = 1 do dec(i);
b[i] := 1;
for j := i + 1 to n do b[j] := 0;
end;
end;
begin
assign(input,'dqbn08.inp');reset(input);
assign(output,'dqbn08.out');rewrite(output);
readln(n, k);
for i := 1 to n do read(a[i]);
rmax := low(longint);
sinh1;
sinh2;
writeln(rmax);
close(input);close(output);
end.




Được sửa bởi Nguyễn Phúc Tâm ngày Thu Aug 11, 2022 3:21 pm; sửa lần 2.
Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyThu Aug 11, 2022 9:29 am

// DQBN9
uses math;
var
 i, j, n, p, rmin: longint;
 a, b, c: array[-7..100007] of longint;
procedure xuli1();
var s0, s1: longint;
begin
   s0 := 0;s1 := 0;
   for i := 1 to n do
     if b[i] = 1 then s1 := s1 + a[i]
     else s0 := s0 + a[i];
   rmin := min(rmin, abs(s1 - s0));
end;
procedure sinh1();
var i, j: longint;
begin
   for i := 1 to n do b[i] := 0;
   i := n;
   while i > 0 do
     begin
         xuli1();
         i := n;
         while b[i] = 1 do dec(i);
         b[i] := 1;
         for j := i + 1 to n do b[j] := 0;
     end;
end;
procedure xuli2();
var s0, s1: longint;
begin
   s0 := 0;s1 := 0;
   for i := 1 to n do
     if b[i] = 1 then s1 := s1 + a[i]
     else s0 := s0 + a[i];
   if abs(s1 - s0) = rmin then
     begin
         p := 1;
         for i := 1 to n do
           if b[i] = 0 then write(i,#32);
         writeln;
         for i := 1 to n do
           if b[i] = 1 then write(i,#32);
         writeln;
         writeln(rmin);
     end;
end;
procedure sinh2();
var i, j: longint;
begin
   for i := 1 to n do b[i] := 0;
   i := n;
   while i > 0 do
     begin
         xuli2();
         i := n;
         while b[i] = 1 do dec(i);
         b[i] := 1;
         for j := i + 1 to n do b[j] := 0;
     end;
end;
begin
   assign(input,'dqbn9.inp');reset(input);
   assign(output,'dqbn9.out');rewrite(output);
   readln(n);
   for i := 1 to n do read(a[i]);
   rmin := high(longint);p := 0;
   sinh1;
   sinh2;
   if p = 0 then writeln(-1);
   close(input);close(output);
end.


Được sửa bởi Nguyễn Phúc Tâm ngày Thu Aug 11, 2022 2:40 pm; sửa lần 1.
Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyThu Aug 11, 2022 9:44 am

// DQBN10
uses math;
var
 n, k, ii, rmax: longint;
 a, b, c: array[-7..100007] of longint;
procedure xuli();
var p, sb, sc: longint;
begin
   sb := 0;sc := 0;
   for p := 1 to n do
     if a[p] = 1 then
       begin
           sb := sb + b[p];
           sc := sc + c[p];
       end;
   if (sb mod k = 0) then rmax := max(rmax, sc);
end;
procedure sinh();
var i, j: longint;
begin
   for i := 1 to n do a[i] := 0;
   i := n;
   while i > 0 do
     begin
         xuli;
         i := n;
         while a[i] = 1 do dec(i);
         a[i] := 1;
         for j := i+1 to n do a[j] := 0;
     end;
end;
begin
   assign(input,'dqbn10.inp');reset(input);
   assign(output,'dqbn10.out');rewrite(output);
   readln(n, k);
   for ii := 1 to n do read(b[ii]);
   for ii := 1 to n do read(c[ii]);
   rmax := low(longint);
   sinh;
   writeln(rmax);
   close(input);close(output);
end.


Được sửa bởi Nguyễn Phúc Tâm ngày Thu Aug 11, 2022 2:41 pm; sửa lần 1.
Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyThu Aug 11, 2022 2:13 pm

// DQBN11
uses math;
var
 n, k, ii, rmax, q: longint;
 a, b, c: array[-7..100007] of longint;
procedure xuli();
var p, sb, sc: longint;
begin
   sb := 0;sc := 0;
   for p := 1 to n do
     if a[p] = 1 then
       begin
           sb := sb + b[p];
           if sb > k then exit;
           sc := sc + c[p];
       end;
   //writeln(sb,#32,sc);
   if (sb <= k) and (rmax < sc) then
     begin
         rmax := sc;
         q := 1;
     end;
end;
procedure sinh();
var i, j: longint;
begin
   for i := 1 to n do a[i] := 0;
   i := n;
   while i > 0 do
     begin
         xuli;
         i := n;
         while a[i] = 1 do dec(i);
         a[i] := 1;
         for j := i+1 to n do a[j] := 0;
     end;
end;
begin
   assign(input,'dqbn11.inp');reset(input);
   assign(output,'dqbn11.out');rewrite(output);
   readln(n, k);
   for ii := 1 to n do read(b[ii]);
   for ii := 1 to n do read(c[ii]);
   rmax := low(longint);q := 0;
   sinh;
   if q = 1 then writeln(rmax)
   else writeln(-1);
   close(input);close(output);
end.


Được sửa bởi Nguyễn Phúc Tâm ngày Thu Aug 11, 2022 2:41 pm; sửa lần 1.
Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyThu Aug 11, 2022 2:32 pm

// DQBN12
uses math;
var
 n, k, ii, res: longint;
 a, b, c: array[-7..100007] of longint;
procedure xuli1();
var p, sb, sc, rmax, rmin: longint;
begin
   sb := 0;rmax := low(longint);rmin := high(longint);
   for p := 1 to n do
     if a[p] = 1 then
       begin
           sb := sb + b[p];
           rmax := max(rmax, c[p]);
           rmin := min(rmin, c[p]);
       end;
   if sb = k then res := abs(rmax - rmin);
end;
procedure sinh1();
var i, j: longint;
begin
   for i := 1 to n do a[i] := 0;
   i := n;
   while i > 0 do
     begin
         xuli1;
         i := n;
         while a[i] = 1 do dec(i);
         a[i] := 1;
         for j := i+1 to n do a[j] := 0;
     end;
end;
procedure xuli2();
var p, sb, sc, rmax, rmin: longint;
begin
   sb := 0;rmax := low(longint);rmin := high(longint);
   for p := 1 to n do
     if a[p] = 1 then
       begin
           sb := sb + b[p];
           rmax := max(rmax, c[p]);
           rmin := min(rmin, c[p]);
       end;
   if (sb = k) and (abs(rmax - rmin) = res) then
     begin
         for p := 1 to n do write(a[p],#32);
         writeln;
     end;
end;
procedure sinh2();
var i, j: longint;
begin
   for i := 1 to n do a[i] := 0;
   i := n;
   while i > 0 do
     begin
         xuli2;
         i := n;
         while a[i] = 1 do dec(i);
         a[i] := 1;
         for j := i+1 to n do a[j] := 0;
     end;
end;
begin
   assign(input,'dqbn12.inp');reset(input);
   assign(output,'dqbn12.out');rewrite(output);
   readln(n, k);
   for ii := 1 to n do read(b[ii]);
   for ii := 1 to n do read(c[ii]);
   sinh1;
   sinh2;
   close(input);close(output);
end.


Được sửa bởi Nguyễn Phúc Tâm ngày Thu Aug 11, 2022 2:42 pm; sửa lần 1.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyThu Aug 11, 2022 2:39 pm

// DQBN13
uses math;
var
n, k, ii, res: longint;
a, b, c: array[-7..100007] of longint;
procedure xuli1();
var p, sb, sc, d: longint;
begin
sb := 0;sc := 0;d := 0;
for p := 1 to n do
if a[p] = 1 then
begin
sb := sb + b[p];
sc := sc + c[p];
inc(d);
if d > k then exit;
end;
res := sb + sc;
end;
procedure sinh1();
var i, j: longint;
begin
for i := 1 to n do a[i] := 0;
i := n;
while i > 0 do
begin
xuli1;
i := n;
while a[i] = 1 do dec(i);
a[i] := 1;
for j := i+1 to n do a[j] := 0;
end;
end;
begin
assign(input,'dqbn13.inp');reset(input);
assign(output,'dqbn13.out');rewrite(output);
readln(n, k);
for ii := 1 to n do read(b[ii]);
for ii := 1 to n do read(c[ii]);
res := low(longint);
sinh1;
writeln(res);
close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyThu Aug 11, 2022 2:58 pm

// DQBN14
uses math;
var
 n, m, v, ii, res: longint;
 a, b, c, d, f: array[-7..100007] of longint;
procedure xuli1();
var p: longint;
sb, sc, sd: int64;
begin
   sb := 0;sc := 0;sd := 0;
   for p := 1 to n do
     if a[p] = 1 then
       begin
           sb := sb + b[p];
           if sb > m then exit;
           sc := sc + c[p];
           sd := sd + d[p];
           if sd > v then exit;
       end;
   if sc > res then res := sc;
end;
procedure sinh1();
var i, j: longint;
begin
   for i := 1 to n do a[i] := 0;
   i := n;
   while i > 0 do
     begin
         xuli1;
         i := n;
         while a[i] = 1 do dec(i);
         a[i] := 1;
         for j := i+1 to n do a[j] := 0;
     end;
end;
begin
   assign(input,'dqbn14.inp');reset(input);
   assign(output,'dqbn14.out');rewrite(output);
   readln(n, m, v);
   for ii := 1 to n do read(b[ii]);
   for ii := 1 to n do read(c[ii]);
   for ii := 1 to n do read(d[ii]);
   res := low(longint);
   sinh1;
   writeln(res);
   close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyThu Aug 11, 2022 3:26 pm

// DQBN15
uses math;
var
n, k, m, v, ii, res: longint;
a, b, c, d: array[-7..100007] of longint;
procedure xuli();
var p, dem: longint;
sb, sc, sd: int64;
begin
sb := 0;sc := 0;sd := 0;dem := 0;
for p := 1 to n do
if a[p] = 1 then
begin
inc(dem);
if dem > k then exit;
sb := sb + b[p];
if sb > m then exit;
sc := sc + c[p];
sd := sd + d[p];
if sd > v then exit;
end;
res := max(res, sc);
end;
procedure sinh();
var i, j: longint;
begin
for i := 1 to n do a[i] := 0;
i := n;
while i > 0 do
begin
xuli();
i := n;
while a[i] = 1 do dec(i);
a[i] := 1;
for j := i+1 to n do a[j] := 0;
end;
end;
begin
assign(input,'dqbn15.inp');reset(input);
assign(output,'dqbn15.out');rewrite(output);
readln(n, k, m, v);
for ii := 1 to n do read(b[ii]);
for ii := 1 to n do read(c[ii]);
for ii := 1 to n do read(d[ii]);
res := low(longint);
sinh;
writeln(res);
close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyThu Aug 11, 2022 4:01 pm

// DQBN16
uses math;
var
n, k, m, v, ii, res: longint;
a, b, c, d, f: array[-7..100007] of longint;
procedure xuli1();
var p, dem: longint;
sb, sc, sd: int64;
begin
sb := 0;sc := 0;sd := 0;dem := 0;
for p := 1 to n do
if a[p] = 1 then
begin
inc(dem);
sb := sb + b[p];
if sb > m then exit;
sc := sc + c[p];
if sc > k then exit;
sd := sd + d[p];
if sd > v then exit;
end;
if dem > res then
begin
res := dem;
for p := 1 to n do f[p] := a[p];
end;
end;
procedure sinh1();
var i, j: longint;
begin
for i := 1 to n do a[i] := 0;
i := n;
while i > 0 do
begin
xuli1();
i := n;
while a[i] = 1 do dec(i);
a[i] := 1;
for j := i+1 to n do a[j] := 0;
end;
end;
begin
assign(input,'dqbn16.inp');reset(input);
assign(output,'dqbn16.out');rewrite(output);
readln(n, k, m, v);
for ii := 1 to n do read(b[ii]);
for ii := 1 to n do read(c[ii]);
for ii := 1 to n do read(d[ii]);
res := low(longint);
sinh1;
for ii := 1 to n do
if f[ii] = 1 then write(ii,#32);
writeln;
writeln(res);
close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyThu Aug 11, 2022 7:52 pm

// EMERALD
var
n, ii, s: longint;
a, b: array[-7..100007] of longint;
procedure xuli();
var p: longint;
s0, s1, s2: int64;
begin
s0 := 0;s1 := 0;s2 := 0;
for p := 1 to n do
if b[p] = 0 then s0 := s0 + a[p]
else
if b[p] = 1 then s1 := s1 + a[p]
else s2 := s2 + a[p];
if (s0 = s1) and (s1 = s2) then
begin
writeln(s2);
for p := 1 to n do
if b[p] = 2 then write(p,#32);
writeln();
end;
end;
procedure thu(i: longint);
var j: longint;
begin
for j := 0 to 2 do
begin
b[i] := j;
if i = n then xuli()
else thu(i+1);
end;
end;
begin
assign(input,'emerald.inp');reset(input);
assign(output,'emerald.out');rewrite(output);
readln(n);
s := 0;
for ii := 1 to n do
begin
read(a[ii]);
s := s + a[ii];
end;
if s mod 3 = 0 then thu(1)
else writeln(0);
close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyFri Aug 12, 2022 9:50 am

// MODM
uses math;
var
n, m, k, ii, res: longint;
a, b, c, d, f: array[-7..100007] of longint;
procedure xuli1();
var p, q, h: longint;
begin
k := 0;h := 0;
for p := 1 to n do
if b[p] = 1 then
begin
inc(k);
c[k] := a[p];
d[k] := p;
end;
for p := 1 to k-1 do
for q := p+1 to k do
if (c[p] + c[q]) mod m = 0 then exit();
if res < k then
begin
res := k;
for p := 1 to n do f[p] := d[p];
end;
end;
procedure sinh1();
var i, j: longint;
begin
for i := 1 to n do b[i] := 0;
i := n;
while i > 0 do
begin
xuli1();
i := n;
while b[i] = 1 do dec(i);
b[i] := 1;
for j := i+1 to n do b[j] := 0;
end;
end;
begin
assign(input,'modm.inp');reset(input);
assign(output,'modm.out');rewrite(output);
readln(n, m);
for ii := 1 to n do read(a[ii]);
k := 0;res := 0;
sinh1;
writeln(res);
for ii := 1 to res do write(f[ii],#32);
close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyFri Aug 12, 2022 9:59 am

// FINANCIAL
uses math;
var
n, k, ii, res: longint;
a, b, c, d: array[-7..100007] of longint;
procedure xuli();
var p, q, h: longint;
begin
h := 0;
for p := 1 to n do
if b[p] = 1 then
begin
inc(h);
c[h] := a[p];
end;
for p := 1 to h do
if abs(c[p-1] - c[p]) < k then exit();
if res < h then
begin
res := h;
for p := 1 to res do d[p] := c[p];
end;
end;
procedure sinh();
var i, j: longint;
begin
for i := 1 to n do b[i] := 0;
i := n;
while i > 0 do
begin
xuli();
i := n;
while b[i] = 1 do dec(i);
b[i] := 1;
for j := i+1 to n do b[j] := 0;
end;
end;
begin
assign(input,'financial.inp');reset(input);
assign(output,'financial.out');rewrite(output);
readln(n, k);
for ii := 1 to n do read(a[ii]);
res := 0;
sinh;
writeln(res);
for ii := 1 to res do write(d[ii],#32);
close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyFri Aug 12, 2022 10:24 am

// BINARY
var
n, res: longint;
s: string;
a: array[-7..100007] of longint;
procedure xuli();
var sa: string;
p, d, tam: longint;
begin
sa := '';d := 0;
for p := 1 to n do
if a[p] = 1 then sa := sa + '1'
else sa := sa + '0';
while pos(s, sa) > 0 do
begin
inc(d);
sa := copy(sa, pos(s, sa) + length(s), length(sa) - pos(s, sa) + length(s));
end;
if d <> 1 then exit();
inc(res);
end;
procedure sinh();
var i, j: longint;
begin
for i := 1 to n do a[i] := 0;
i := n;
while i > 0 do
begin
xuli();
i := n;
while a[i] = 1 do dec(i);
a[i] := 1;
for j := i+1 to n do a[j] := 0;
end;
end;
begin
assign(input,'binary.inp');reset(input);
assign(output,'binary.out');rewrite(output);
readln(n);
readln(s);
res := 0;
sinh;
writeln(res);
close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyMon Aug 22, 2022 8:00 pm

Code:
//DQCKN1
var
 n, k, i: longint;
 a: array[-7..100007] of longint;
procedure xuli();
var p: longint;
begin
   for p := 1 to k do write(a[p],#32);
   writeln();
end;
procedure thu(i: longint);
var j: longint;
begin
   for j := a[i-1]+1 to n-k+i do
     begin
         a[i] := j;
         if i = k then xuli()
         else thu(i+1);
     end;
end;
begin
   assign(input,'dqckn1.inp');reset(input);
   assign(output,'dqckn1.out');rewrite(output);
   readln(n, k);
   thu(1);
   close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyMon Aug 22, 2022 8:40 pm

Code:
//DQCKN2
var
  n, k, i, s: longint;
  a, b: array[-7..100007] of longint;
procedure xuli();
var p, t: longint;
begin
    t := 0;
    for p := 1 to k do
      begin
          t := t + b[a[p]];
          if t > s then exit();
      end;
    if t = s then
      begin
          for p := 1 to k do write(b[a[p]],#32);
          writeln();
      end;
end;
procedure thu(i: longint);
var j: longint;
begin
    for j := a[i-1]+1 to n-k+i do
      begin
          a[i] := j;
          if i = k then xuli()
          else thu(i+1);
      end;
end;
begin
    assign(input,'dqckn2.inp');reset(input);
    assign(output,'dqckn2.out');rewrite(output);
    readln(n, s, k);
    for i := 1 to n do read(b[i]);
    thu(1);
    close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyMon Aug 22, 2022 8:51 pm

Code:
//DQCKN3
var
  n, k, i: longint;
  a, b: array[-7..100007] of longint;
function snt(u: longint): boolean;
var j: longint;
begin
    if u <= 1 then exit(false);
    if (u = 2) or (u = 3) then exit(true);
    for j := 2 to trunc(sqrt(u)) do
      if u mod j = 0 then exit(false);
    exit(true);
end;
procedure xuli();
var p, t: longint;
begin
    t := 0;
    for p := 1 to k do t := t + b[a[p]];
    if snt(t) then
      begin
          for p := 1 to k do write(b[a[p]],#32);
          writeln();
      end;
end;
procedure thu(i: longint);
var j: longint;
begin
    for j := a[i-1]+1 to n-k+i do
      begin
          a[i] := j;
          if i = k then xuli()
          else thu(i+1);
      end;
end;
begin
    assign(input,'dqckn3.inp');reset(input);
    assign(output,'dqckn3.out');rewrite(output);
    readln(n, k);
    for i := 1 to n do read(b[i]);
    thu(1);
    close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyMon Aug 22, 2022 9:00 pm

Code:
//DQCKN4
uses math;
var
  n, k, i, res: longint;
  a, b: array[-7..100007] of longint;
function pali(u: longint): boolean;
var s, v: longint;
begin
    s := 0;v := u;
    while u > 0 do
      begin
          s := s * 10 + (u mod 10);
          u := u div 10;
      end;
    if s = v then exit(true)
    else exit(false);
end;
procedure xuli();
var p, t: longint;
begin
    t := 0;
    for p := 1 to k do t := t + b[a[p]];
    if pali(t) then res := max(res, t);
end;
procedure thu(i: longint);
var j: longint;
begin
    for j := a[i-1]+1 to n-k+i do
      begin
          a[i] := j;
          if i = k then xuli()
          else thu(i+1);
      end;
end;
begin
    assign(input,'dqckn4.inp');reset(input);
    assign(output,'dqckn4.out');rewrite(output);
    readln(n, k);
    for i := 1 to n do read(b[i]);
    res := 0;
    thu(1);
    writeln(res);
    close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyMon Aug 22, 2022 9:16 pm

Code:
//DQCKN5
uses math;
var
  n, k, i, rmin, rmax: longint;
  a, b, c: array[-7..100007] of longint;
procedure xuli();
var q, t, p1, p2: longint;
begin
    t := 0;p1 := 0;p2 := 0;
    for q := 1 to k do c[q] := b[a[q]];
    for q := 1 to k do
      begin
          if b[a[q]] = rmin then p1 := 1;
          if b[a[q]] = rmax then p2 := 1;
          if (p1 = 1) and (p2 = 1) then break;
      end;
    if (p1 = 1) and (p2 = 1) then
      begin
          for q := 1 to k do write(c[q],#32);
          writeln();
      end;
end;
procedure thu(i: longint);
var j: longint;
begin
    for j := a[i-1]+1 to n-k+i do
      begin
          a[i] := j;
          if i = k then xuli()
          else thu(i+1);
      end;
end;
begin
    assign(input,'dqckn51.inp');reset(input);
    assign(output,'dqckn51.out');rewrite(output);
    readln(n, k);
    rmin := high(longint);rmax := low(longint);
    for i := 1 to n do
      begin
          read(b[i]);
          rmin := min(rmin, b[i]);
          rmax := max(rmax, b[i]);
      end;
    thu(1);
    close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Nguyễn Phúc Tâm




Tổng số bài gửi : 96
Join date : 07/07/2022

Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm EmptyTue Aug 23, 2022 3:41 pm

Code:
//DQCKN6
uses math;
var
  n, k, m, i, res: longint;
  a, b, c: array[-7..100007] of longint;
procedure xuli();
var q, sb, sc: longint;
begin
    sb:= 0;sc:= 0;
    for q := 1 to k do
      begin
          sb := sb + b[a[q]];
          if sb > m then exit();
          sc := sc + c[a[q]];
      end;
    res := max(res, sc);
end;
procedure thu(i: longint);
var j: longint;
begin
    for j := a[i-1]+1 to n-k+i do
      begin
          a[i] := j;
          if i = k then xuli()
          else thu(i+1);
      end;
end;
begin
    assign(input,'dqckn6.inp');reset(input);
    assign(output,'dqckn6.out');rewrite(output);
    readln(n, k, m);
    for i := 1 to n do read(b[i]);
    readln;
    for i := 1 to n do read(c[i]);
    res := low(longint);
    thu(1);
    writeln(res);
    close(input);close(output);
end.

Nguyễn Phúc Tâm likes this post

Về Đầu Trang Go down
Sponsored content





Nguyễn Phúc Tâm Empty
Bài gửiTiêu đề: Re: Nguyễn Phúc Tâm   Nguyễn Phúc Tâm Empty

Về Đầu Trang Go down
 
Nguyễn Phúc Tâm
Về Đầu Trang 
Trang 1 trong tổng số 2 trangChuyển đến trang : 1, 2  Next
 Similar topics
-
» Nguyễn Phúc Tâm
» Nguyễn Phúc Tâm
» Nguyễn Quang Phúc
» Đỗ Hoàng Phúc
» đỗ hoàng phúc

Permissions in this forum:Bạn không có quyền trả lời bài viết
Hệ sinh thái số IELP :: Thực nghiệm phần C++ :: 3-Lập trình cơ bản 2-
Chuyển đến