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 |
---|
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
| Tiêu đề: Nguyễn Trung Hiếu Thu Jun 23, 2022 8:02 pm | |
| Nơi nộp bài của Nguyễn Trung Hiếu | |
| | | lyo2850
Tổng số bài gửi : 47 Join date : 08/06/2022
| Tiêu đề: Re: Nguyễn Trung Hiếu Fri Jun 24, 2022 8:14 pm | |
| - Code:
-
var n,t:int64; begin assign(input,'ncount.inp');reset(input); readln(n); close(input); assign(output,'ncount.out');rewrite(output); while n>0 do begin t:=t+ n mod 10; n:=n div 10; end; write(t); 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 Fri Jun 24, 2022 8:15 pm | |
| - Code:
-
var n,t,i,s:longint; begin assign(input,'dcount.inp');reset(input); read(n); close(input); assign(output,'dcount.out');rewrite(output); for i:=1 to n do begin t:=i; while t>0 do begin s:=s+1; t:=t div 10; end; end; write(s); 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 Fri Jun 24, 2022 8:15 pm | |
| - Code:
-
var n,t:longint; begin assign(input,'xchange.inp');reset(input); readln(n); close(input); assign(output,'xchange.out');rewrite(output); t:=n div 50; n:=n mod 50; t:=t+n div 20; n:=n mod 20; t:=t+n div 10; n:=n mod 10; if n=0 then write(t) else write(-1); 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 Fri Jun 24, 2022 8:15 pm | |
| - Code:
-
var n,t,s:int64; begin assign(input,'xmax.inp');reset(input); read(n); close(input); assign(output,'xmax.out');rewrite(output); while n>0 do begin t:=n mod 10; if s<t then s:=t; n:=n div 10; end; write(s); 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 Fri Jun 24, 2022 8:16 pm | |
| - Code:
-
var n,t,i:longint; begin assign(input,'sdiv.inp');reset(input); read(n); close(input); assign(output,'sdiv.out');rewrite(output); for i:=1 to trunc(sqrt(n)) do if (n mod i = 0) then if (n div i = i) then t:=t+i else t:=t+i+ n div i; write(t); 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 Fri Jun 24, 2022 8:16 pm | |
| - Code:
-
var i,a,x:longint; s:int64; function mu(u,v:longint):int64; var temp:int64; begin if (v=0) then exit(1) else if (v=1) then exit(u) else begin temp:= mu(u,v div 2); temp:=temp*temp*mu(u,v mod 2); temp:=temp mod 1000000007; exit(temp); end; end; begin assign(input,'amux.inp');reset(input); read(a,x); close(input); assign(output,'amux.out');rewrite(output); s:=mu(a,x); write(s); 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 Fri Jun 24, 2022 8:16 pm | |
| - Code:
-
var n:int64; s:real; begin assign(input,'squa.inp');reset(input); read(n); close(input); assign(output,'squa.out');rewrite(output); s:=exp(ln(n)*(1/3)); write(s:0:3); 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 Fri Jun 24, 2022 8:17 pm | |
| - Code:
-
var n,i,t:longint; begin assign(input,'ckprime.inp');reset(input); read(n); close(input); assign(output,'ckprime.out');rewrite(output); for i:=2 to trunc(sqrt(n)) do if (n mod i = 0) then t:=1; if t=1 then write('false') else write('true'); 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 Fri Jun 24, 2022 8:17 pm | |
| - Code:
-
var n,i,d,j:longint; t,x:array [0..10000] of longint; begin assign(input,'fprime.inp');reset(input); readln(n); close(input); assign(output,'fprime.out');rewrite(output); t[1]:=1;t[2]:=1;d:=2; while t[d]<n do begin d:=d+1; t[d]:=t[d-1]+t[d-2]; end; d:=d-1; for i:=1 to t[d] do x[i]:=1;i:=2;x[1]:=0; while (i<=trunc(sqrt(t[d]))) do if x[i]=1 then begin j:=2; while (i*j<=t[d]) do begin x[i*j]:=0; j:=j+1; end; i:=i+1; end else i:=i+1; j:=0; for i:=1 to d do if x[t[i]]=1 then j:=j+1; write(j);
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 Fri Jun 24, 2022 8:17 pm | |
| - Code:
-
var n,i,j:longint; x:array [0..10000] of longint; begin assign(input,'eratos.inp');reset(input); readln(n); close(input); assign(output,'eratos.out');rewrite(output); for i:=1 to n do x[i]:=1;i:=2;x[1]:=0; while i<=trunc(sqrt(n)) do if x[i]=1 then begin j:=2; while i*j<=n do begin x[i*j]:=0; j:=j+1; end; i:=i+1; end else i:=i+1; for i:=1 to n do if x[i]=1 then write(i,' '); 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 Fri Jun 24, 2022 8:18 pm | |
| - Code:
-
var n:longint; procedure tsnt(u:longint); var i:longint; begin i:=2; while i*i<=u do begin if (u mod i = 0) then begin write(i,' ');u:=u div i; end else i:=i+1; end; if u>1 then write(u); end;
begin assign(input,'tsnt.inp');reset(input); read(n); close(input); assign(output,'tsnt.out');rewrite(output); tsnt(n); 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 Fri Jun 24, 2022 8:18 pm | |
| - Code:
-
var i,j,t,v,d,n:longint; x:array [0..10000] of longint; procedure tsnt(u:longint); var i:longint; begin i:=2; while i*i<=u do begin if (u mod i = 0) then begin v:=v+1;x[v]:=i;u:=u div i; end else i:=i+1; end; if u>1 then x[v+1]:=u; end;
begin assign(input,'nfind.inp');reset(input); read(n); close(input); assign(output,'nfind.out');rewrite(output); tsnt(n); if x[v+1]>=10 then write(-1) else begin for i:=v+1 downto 2 do if (x[i]<>0) and (x[i]*x[i-1]<10) then begin x[i]:=x[i-1]*x[i]; x[i-1]:=0; end; for i:=1 to v do for j:=i+1 to v+1 do if x[i]>x[j] then begin t:=x[i];x[i]:=x[j];x[j]:=t; end; for i:=1 to v+1 do if x[i]<>0 then write(x[i]); end; 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 Fri Jun 24, 2022 8:18 pm | |
| - Code:
-
uses math; var o,i,n,m,res,t:longint; function nt(u:longint):boolean; var i:longint; begin if u<2 then exit(false); if u<4 then exit(true); for i:=2 to trunc(sqrt(u)) do if (u mod i = 0) then exit(false); exit(true); end; begin assign(input,'numberc.inp');reset(input); read(n); close(input); assign(output,'numberc.out');rewrite(output); n:=n div 10; while (nt(n)=false) and (n>0) do n:=n div 10; if n>0 then write(n) else write(-1); 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 Fri Jun 24, 2022 8:19 pm | |
| - Code:
-
uses math; var n,i:longint; a:array [0..100000] of longint; begin assign(input,'arrdel.inp');reset(input); readln(n); for i:=1 to n do read(a[i]); close(input); assign(output,'arrdel.out');rewrite(output); for i:=1 to n do if a[i]<>a[i-1] then write(a[i],' '); 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 Fri Jun 24, 2022 8:20 pm | |
| - Code:
-
var n,o:longint; a:array [0..1000000] of longint; Procedure qsort(L, H:longint); Var i,j,mid, temp:longint; Begin If (L>H) then exit(); I:=L; J:=H; Mid:=a[(i+j) div 2]; While i<=j do Begin While a[i]<mid do inc(i); While a[j]>mid do dec(j); If i<=j then Begin Temp:=a[i]; A[i]:=a[j]; A[j]:=temp; Inc(i); dec(j); End;
End; If L < j then qsort(L,j); If i < H then qsort(i,H); End;
begin assign(input,'qsort.inp');reset(input); readln(n); for o:=1 to n do read(a[o]); close(input); assign(output,'qsort.out');rewrite(output); qsort(1,n); for o:=1 to n do write(a[o],' '); 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 Fri Jun 24, 2022 8:20 pm | |
| - Code:
-
var n,i,t:longint; a,fx:array [0..1000000] of longint; begin assign(input,'ilucky.inp');reset(input); readln(n); for i:=1 to n do read(a[i]); close(input); assign(output,'ilucky.out');rewrite(output); for i:=1 to n do fx[i]:=fx[i-1]+a[i]; for i:=1 to n-1 do if (fx[i]=fx[n]-fx[i]) then begin write(i,' '); t:=-1; end; if t=0 then write(-1); 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 Fri Jun 24, 2022 8:20 pm | |
| - Code:
-
uses math; var n,i,res:longint; a:array [0..1000000] of longint; begin assign(input,'pmin.inp');reset(input); readln(n); for i:=1 to n do read(a[i]); close(input); assign(output,'pmin.out');rewrite(output); res:=high(longint); for i:=1 to n do res:=min(res,a[i]); for i:=1 to n do if a[i]=res then write(i,' '); 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 Fri Jun 24, 2022 8:21 pm | |
| - Code:
-
var n,i,o:longint; a,b:array [0..1000000] of longint; Procedure qsort(L, H:longint); Var i,j,mid, temp:longint; Begin If (L>H) then exit(); I:=L; J:=H; Mid:=a[(i+j) div 2]; While i<=j do Begin While a[i]<mid do inc(i); While a[j]>mid do dec(j); If i<=j then Begin Temp:=a[i]; A[i]:=a[j]; A[j]:=temp; Inc(i); dec(j); End;
End; If L < j then qsort(L,j); If i < H then qsort(i,H); End; begin assign(input,'psecond.inp');reset(input); readln(n); for i:=1 to n do read(a[i]); close(input); assign(output,'psecond.out');rewrite(output); for i:=1 to n do b[i]:=a[i]; qsort(1,n);i:=2; while (a[1]=a[i]) and (i<=n) do i:=i+1; if i=n+1 then write(-1) else for o:=1 to n do if b[o]=a[i] then write(o,' '); 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 22, 2022 8:15 pm | |
| - Code:
-
var n,k:longint; x:array [0..100000] of longint; procedure xuli; var i:longint; begin for i:=1 to k do write(x[i],' '); writeln(); 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 thu(u+1) else xuli; end; end; begin assign(input,'dqckn1.inp');reset(input); read(n,k); close(input); assign(output,'dqckn1.out');rewrite(output); thu(1); 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 22, 2022 8:38 pm | |
| - Code:
-
var n,k,s,i:longint; x,a:array [0..100000] of longint; procedure xuli; var i,t:longint; begin t:=0; for i:=1 to k do t:=t+a[x[i]]; if (t=s) then begin for i:=1 to k do write(a[x[i]],' '); writeln(); 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 thu(u+1) else xuli; end; end; begin assign(input,'dqckn2.inp');reset(input); readln(n,s,k); for i:=1 to n do read(a[i]); close(input); assign(output,'dqckn2.out');rewrite(output); thu(1); 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 22, 2022 8:54 pm | |
| - Code:
-
var n,k,i:longint; x,a:array [0..100000] of longint; function nt(u:longint):boolean; var v:longint; begin u:=abs(u); if (u=1) then exit(false); if (u=2) or (u=3) then exit(true); for v:=2 to trunc(sqrt(u)) do if (u mod v = 0) then exit(false); exit(true); end; procedure xuli; var i,t:longint; begin t:=0; for i:=1 to k do t:=t+a[x[i]]; if nt(t) then begin for i:=1 to k do write(a[x[i]],' '); writeln(); end; end; procedure thu(u:longint); var v,p:longint; begin for v:=x[u-1]+1 to n-k+u do begin x[u]:=v; if u<k then thu(u+1) else xuli; end; end; begin assign(input,'dqckn3.inp');reset(input); readln(n,k); for i:=1 to n do read(a[i]); close(input); assign(output,'dqckn3.out');rewrite(output); thu(1); 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 22, 2022 9:00 pm | |
| - Code:
-
uses math; var n,k,i,res:longint; x,a:array [0..100000] of longint; function dx(u:longint):boolean; var v,v1,t:longint; begin v:=0;v1:=u; while (u>0) do begin t:=u mod 10; v:=v*10 + t; u:=u div 10; end; if (v1=v) then exit(true) else exit(false); end; procedure xuli; var i,t:longint; begin t:=0; for i:=1 to k do t:=t+a[x[i]]; if dx(t) then res:=max(res,t); end; procedure thu(u:longint); var v,p:longint; begin for v:=x[u-1]+1 to n-k+u do begin x[u]:=v; if u<k then thu(u+1) else xuli; end; end; begin assign(input,'dqckn4.inp');reset(input); readln(n,k); for i:=1 to n do read(a[i]); close(input); assign(output,'dqckn4.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 22, 2022 9:13 pm | |
| - Code:
-
uses math; var n,k,i,res,mi,ma:longint; x,a:array [0..100000] of longint; function kt:boolean; var v,v1,v2,t:longint; begin v1:=0;v2:=0; for i:=1 to k do begin if a[x[i]]=ma then v1:=1; if a[x[i]]=mi then v2:=1; end; v:=v1+v2; if v=2 then exit(true) else exit(false); end; procedure xuli; var i,t:longint; begin if kt then begin for i:=1 to k do write(a[x[i]],' '); writeln(); end; end; procedure thu(u:longint); var v,p:longint; begin for v:=x[u-1]+1 to n-k+u do begin x[u]:=v; if u<k then thu(u+1) else xuli; end; end; begin assign(input,'dqckn51.inp');reset(input); readln(n,k); for i:=1 to n do read(a[i]); close(input); assign(output,'dqckn51.out');rewrite(output); ma:=a[1];mi:=a[1]; for i:=1 to n do begin ma:=max(ma,a[i]); mi:=min(mi,a[i]); end; thu(1); 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:12 pm | |
| - Code:
-
uses math; var a,b,x,kt:array [0..100000] of longint; res,n,k,m,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+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,'dqckn6.inp');reset(input); readln(n,k,m); for i:=1 to n do read(a[i]); for i:=1 to n do read(b[i]); close(input); assign(output,'dqckn6.out');rewrite(output); thu(1); write(res); 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
| |
| |
| |