May 2024 | Mon | Tue | Wed | Thu | Fri | Sat | Sun |
---|
| | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | Calendar |
|
Top posting users this week | |
| | Nguyễn Trung Hiếu | |
| | |
Tác giả | Thông điệp |
---|
lyo2850
Tổng số bài gửi : 47 Join date : 08/06/2022
| Tiêu đề: Re: Nguyễn Trung Hiếu Mon Aug 29, 2022 9:13 pm | |
| - Code:
-
uses math; var a,b,x,kt:array [0..100000] of longint; res,n,k,i,j:longint; procedure xuli; var i,t:longint; begin t:=0; for i:=1 to k do t:=t+a[x[i]]+b[x[i]]; res:=max(res,t); end; procedure thu(u:longint); var v:longint; begin for v:=x[u-1]+1 to n-k+u do begin x[u]:=v; if u=k then xuli else thu(u+1); end;
end; begin assign(input,'dqckn7.inp');reset(input); readln(n,k); for i:=1 to n do read(a[i]); for i:=1 to n do read(b[i]); close(input); assign(output,'dqckn7.out');rewrite(output); thu(1); write(res); close(output); end.
| |
| | | lyo2850
Tổng số bài gửi : 47 Join date : 08/06/2022
| Tiêu đề: Re: Nguyễn Trung Hiếu Mon Aug 29, 2022 9:15 pm | |
| - Code:
-
uses math; var a,b,c,x,kt:array [0..100000] of longint; res,n,m,p,k,i,j:longint; procedure xuli; var i,t:longint; begin t:=0; for i:=1 to k do t:=t+a[x[i]]; if t>m then exit(); t:=0; for i:=1 to k do t:=t+c[x[i]]; if t>p then exit(); t:=0; for i:=1 to k do t:=t+b[x[i]]; res:=max(res,t); end; procedure thu(u:longint); var v:longint; begin for v:=x[u-1]+1 to n-k+u do begin x[u]:=v; if u=k then xuli else thu(u+1); end;
end; begin assign(input,'dqckn8.inp');reset(input); readln(n,k,m,p); for i:=1 to n do read(a[i]); for i:=1 to n do read(b[i]); for i:=1 to n do read(c[i]); close(input); assign(output,'dqckn8.out');rewrite(output); thu(1); write(res); close(output); end. | |
| | | lyo2850
Tổng số bài gửi : 47 Join date : 08/06/2022
| Tiêu đề: Re: Nguyễn Trung Hiếu Mon Aug 29, 2022 9:15 pm | |
| - Code:
-
uses math; var a,b,c,x,kt:array [0..100000] of longint; res,n,m,p,k,i,j,q,o:longint; procedure xuli; var i,t:longint; begin t:=0; for i:=1 to k do t:=t+a[x[i]]; if t>m then exit(); t:=0; for i:=1 to k do t:=t+c[x[i]]; if t>p then exit(); t:=0; for i:=1 to k do t:=t+b[x[i]]; if t=q then begin for i:=1 to k do write(b[x[i]],' ');writeln(); o:=1; end; end; procedure thu(u:longint); var v:longint; begin for v:=x[u-1]+1 to n-k+u do begin x[u]:=v; if u=k then xuli else thu(u+1); end;
end; begin assign(input,'dqckn9.inp');reset(input); readln(n,k,m,p,q); for i:=1 to n do read(a[i]); for i:=1 to n do read(b[i]); for i:=1 to n do read(c[i]); close(input); assign(output,'dqckn9.out');rewrite(output); thu(1); if o=0 then write(-1); close(output); end. | |
| | | Sponsored content
| Tiêu đề: Re: Nguyễn Trung Hiếu | |
| |
| | | | Nguyễn Trung Hiếu | |
|
Similar topics | |
|
| Permissions in this forum: | Bạn không có quyền trả lời bài viết
| |
| |
| |