Thứ Tư, 4 tháng 4, 2012

Ban beta Tin hoc tre Hau giang THCS 2012

var s,s1,s2:string;
    i,n,k,j:integer;
    f,g:text;
begin
assign(f,'d:\danhsach.inp');reset(f);
assign(g,'d:\danhsach.out');rewrite(g);
readln(f,n);
while not eof(f) do
begin
if n>0 then
begin
readln(f,s);dec(n);
while s[1]=' ' do delete(s,1,1);
while s[length(s)]=' ' do delete(s,length(s),1);
while pos('  ',s)<>0 do delete(s,pos('  ',s),1);
for i:=1 to length(s) do if s[i]=' ' then k:=i;
s1:=s[1];
for i:=1 to length(s) do
if (s[i]=' ') and (i<>k) then
begin
s2:=s[i+1];
s1:=s1+s2;
end;
delete(s,1,k);
s1:=s+s1;s:='';
for i:=1 to length(s1) do
begin
if (ord(s1[i])<97) and (ord(s1[i])>64) then s2:=chr(ord(s1[i])+32)
else s2:=s1[i];
s:=s+s2;
end;
writeln(g,s);
end;end;
close(f);close(g);
readln;
end.

Var i,GTD,GTC,dem:LongInt;
    f,g:text;
    tam,n:byte;
Function KT(i:LongInt):Boolean;
Var j:Integer;
Begin
    KT:=False;
    if i<=1 then exit;
    j:=2;
    while i mod j<>0 do inc(j);
    if j=i then KT:=True;
End;
Function SNT(i:LongInt):Boolean;
Begin
    SNT:=False;
    Repeat
        If KT(i)=False then Exit;
        i:=i div 10;
    Until i=0;
    SNT:=True;
End;
function NT(i:longint):boolean;
var s:string;
    z:integer;
begin
NT:=False;
repeat
if KT(i)=False then Exit;
str(i,s);
delete(s,1,1);
val(s,i,z);
until i=0;
NT:=True;
end;
Begin
     assign(f,'d:\nguyento.inp');reset(f);
     assign(g,'d:\nguyento.out');rewrite(g);
     readln(f,n);
        if (n>10) or (n<0) then writeln('De nghi nhap lai n (0<N<10)') else
        begin
    GTD:=1;GTC:=1;
    if n>=5 then writeln(g,0) else
    begin
    For i:=1 to n-1 do GTD:=GTD*10;
    for i:=1 to n do gtc:=gtc*10;dec(GTC);
        For i:=GTD to gtc do
        If (SNT(i))and(NT(i)) then
        begin
        inc(dem);
        end;writeln(g,dem);
        For i:=GTD to gtc do
        If (SNT(i))and(NT(i)) then
        begin
        write(g,i);;
        write(g,' ');
        end; end;
         end;
         writeln('Nhan Enter de ket thuc');
        close(f);close(g);
    Readln;
End.

var f,g:text;
    n,i,j,k,l:integer;
    a:array[1..10000] of longint;
begin
assign(f,'d:\dayso.inp');reset(f);
assign(g,'d:\dayso.out');rewrite(g);
readln(f,n);
for i:=1 to n do
begin
inc(j);
read(f,k);
if k mod 2<>0 then a[j]:=k else dec(j);
end;
n:=j;
for i:=1 to n do
if a[i]>a[i+1] then
begin
j:=i;
i:=n;
end;
writeln(g,j);
for i:=1 to j do
begin
write(g,a[i]);
write(g,' ');
end;
close(f);close(g);
readln;
end.

Không có nhận xét nào:

Đăng nhận xét