Change background image
Chuyên Tin - Lê Khiết

Go downThông điệp [Trang 1 trong tổng số 1 trang]

© FMvi.vn

Wed Feb 01, 2012 12:08 pm
Admin
Admin
Admin

Code - Huyền Thoại

Giờ mình up link lên trước để chiều nay các bạn tải xuống giải cho nhanh dành thời gian online còn đề thì tối up sau : Link tải tổng hợp ba bài : dãy con tăng dài nhất , dãy v dài nhất , dãy chia hết dài nhất !!!!!! 419969082
-------------------------
[You must be registered and logged in to see this link.]
-------------------------
[You must be registered and logged in to see this link.]
---------------------
[You must be registered and logged in to see this link.]
---------------------
[You must be registered and logged in to see this link.]
https://chuyentinlk.123.st

Thích

Báo xấu [0]

Gửi một bình luận lên tường nhà Admin
Trả lời nhanh
Wed Feb 01, 2012 12:29 pm
Admin
Admin
Admin

Code - Huyền Thoại

Chương trình bài dãy con tăng dài nhất ( ấn cái chữ ' spolier ' để xem )

Ấn vào để xem:
Chương trình :
Code:

Program Bai1;
 Const  fi = 'bai5.inp';
        fo = 'bai5.out';
 Var t,a,l : Array[0..100] Of Integer;
      chon : Array[1..100] Of Boolean;
  n,m,i,j : Integer;
      f,g : Text;
Procedure doctep;
 Var i,j : Integer;
  Begin
  Assign(f,fi);
  Reset(f);
  Readln(f,n);
  For i:=1 to n do
    Read(f,a[i]);
    Readln(f);
  Close(f);
  End;
Procedure khoitao;
 Var i,j : Integer;
  Begin
  For i:=1 to n do
  l[i]:=1;
  Fillchar(chon,sizeof(chon),false);
  End;
Procedure xaydung;
 Var i,j : Integer;
  Begin
  For i:=2 to n do
  For j:=1 to i-1 do
    If a[j]<a[i] then
    If l[i]<l[j]+1 then
      Begin
      l[i]:=l[j]+1;
      t[i]:=j;
      End;
  End;
Procedure truyvet;
 Var max,vt,i,j:Integer;
  Begin
  Assign(g,fo);
  Rewrite(g);
  max:=0;
  For i:=1 to n do
    If l[i]>max then max:=l[i];
  For i:=1 to n do
    If l[i]=max then
    vt:=i;
  Writeln(g,max);
  i:=vt;
  While i>0 do
    Begin
    chon[i]:=true;
    i:=t[i];
    End;
  For i:=1 to n do
    If chon[i]=true then
    Write(g,a[i]:3);
  Close(g);
  End;
Begin
 doctep;
 khoitao;
 xaydung;
 truyvet;
End.
https://chuyentinlk.123.st

Thích

Báo xấu [0]

Gửi một bình luận lên tường nhà Admin
Trả lời nhanh
Wed Feb 01, 2012 12:33 pm
Admin
Admin
Admin

Code - Huyền Thoại

Chương trình bài dãy v dài nhất ( ấn vào chữ ' spolier ' để xem )
Ấn vào để xem:
Chương trình :
Code:

Program Bai1;
 Const  fi = 'bai6.inp';
        fo = 'bai6.out';
 Var l,t2,t1,a,d1,d2 : Array[0..100] Of Integer;
      chon : Array[1..100] Of Boolean;
  n,m,i,j : Integer;
      f,g : Text;
Procedure doctep;
 Var i,j : Integer;
  Begin
  Assign(f,fi);
  Reset(f);
  Readln(f,n);
  For i:=1 to n do
    Read(f,a[i]);
    Readln(f);
  Close(f);
  End;
Procedure khoitao;
 Var i,j : Integer;
  Begin
  For i:=1 to n do
    Begin
    d1[i]:=1;
    d2[i]:=1;
    End;
  Fillchar(chon,sizeof(chon),false);
  End;
Procedure xaydung1;
 Var i,j : Integer;
  Begin
  For i:=2 to n do
  For j:=1 to i-1 do
    If a[j]>a[i] then
    If d1[i]<d1[j]+1 then
      Begin
      d1[i]:=d1[j]+1;
      t1[i]:=j;
      End;
  End;
Procedure xaydung2;
 Var i,j : Integer;
  Begin
  For i:=n-1 downto 1 do
  For j:=n downto i+1 do
    If a[j]>a[i] then
    If d2[i] < d2[j]+1 then
      Begin
      d2[i]:=d2[j]+1;
      t2[i]:=j;
      End;
  End;
Procedure truyvet;
 Var max,vt,i,j:Integer;
  Begin
  Assign(g,fo);
  Rewrite(g);
  max:=0;
  For i:=1 to n do
    l[i]:=d1[i]+d2[i];
  For i:=1 to n do
    If l[i] > max then
    max:=l[i];
  For i:=1 to n do
    If l[i]=max then
    vt:=i;
  Writeln(g,max-1);
  i:=vt;
  While i>0 do
    Begin
    chon[i]:=true;
    i:=t1[i];
    End;
  i:=vt;
  While i>0 do
    Begin
    chon[i]:=true;
    i:=t2[i];
    End;
  For i:=1 to n do
    If chon[i]=true then
    Write(g,a[i]:3);
  Close(g);
  End;
Begin
 doctep;
 khoitao;
 xaydung1;
 xaydung2;
 truyvet;
End.
https://chuyentinlk.123.st

Thích

Báo xấu [0]

Gửi một bình luận lên tường nhà Admin
Trả lời nhanh
Wed Feb 01, 2012 4:01 pm
Admin
Admin
Admin

Code - Huyền Thoại

Chương trình bài dãy chia hết dài nhất ( ấn vào chữ ' spolier ' để xem )
Ấn vào để xem:

Chương trình :
Code:
Program Bai1;
 Const  fi = 'bai7.inp';
        fo = 'bai7.out';
 Var t,a,l : Array[0..100] Of Integer;
      chon : Array[1..100] Of Boolean;
  n,m,i,j : Integer;
      f,g : Text;
Procedure doctep;
 Var i,j : Integer;
  Begin
  Assign(f,fi);
  Reset(f);
  Readln(f,n);
  For i:=1 to n do
    Read(f,a[i]);
    Readln(f);
  Close(f);
  End;
Procedure khoitao;
 Var i,j : Integer;
  Begin
  For i:=1 to n do
  l[i]:=1;
  Fillchar(chon,sizeof(chon),false);
  End;
Procedure xaydung;
 Var i,j : Integer;
  Begin
  For i:=2 to n do
  For j:=1 to i-1 do
    If a[i] mod a[j] = 0 then
    If l[i]<l[j]+1 then
      Begin
      l[i]:=l[j]+1;
      t[i]:=j;
      End;
  End;
Procedure truyvet;
 Var max,vt,i,j:Integer;
  Begin
  Assign(g,fo);
  Rewrite(g);
  max:=0;
  For i:=1 to n do
    If l[i]>max then max:=l[i];
  For i:=1 to n do
    If l[i]=max then
    vt:=i;
  Writeln(g,max);
  i:=vt;
  While i>0 do
    Begin
    chon[i]:=true;
    i:=t[i];
    End;
  For i:=1 to n do
    If chon[i]=true then
    Writeln(g,a[i]:3);
  Close(g);
  End;
Begin
 doctep;
 khoitao;
 xaydung;
 truyvet;
End.
https://chuyentinlk.123.st

Thích

Báo xấu [0]

Gửi một bình luận lên tường nhà Admin
Trả lời nhanh
Thu Feb 02, 2012 1:24 pm
Admin
Admin
Admin

Code - Huyền Thoại

Chương trình bài dãy chia hết dài nhất ( ấn vào chữ ' spolier ' để xem )
Ấn vào để xem:
Chương trình :
Code:
Program Bai1;
 Const  fi = 'bai5.inp';
        fo = 'bai5.out';
 Var t,a,l : Array[0..100] Of Integer;
      chon : Array[1..100] Of Boolean;
  h,n,m,i,j : Integer;
      f,g : Text;
Procedure doctep;
 Var i,j : Integer;
  Begin
  Assign(f,fi);
  Reset(f);
  Readln(f,n,h);
  For i:=1 to n do
    Read(f,a[i]);
    Readln(f);
  Close(f);
  End;
Procedure khoitao;
 Var i,j : Integer;
  Begin
  For i:=1 to n do
  l[i]:=1;
  Fillchar(chon,sizeof(chon),false);
  End;
Procedure xaydung;
 Var i,j : Integer;
  Begin
  For i:=2 to n do
    For j:=1 to i-h do
    If a[j]<a[i] then
    If i-j>=h then
    If l[i]<l[j]+1 then
      Begin
      l[i]:=l[j]+1;
      t[i]:=j;
      End;
  End;
Procedure truyvet;
 Var max,vt,i,j:Integer;
  Begin
  Assign(g,fo);
  Rewrite(g);
  max:=0;
  For i:=1 to n do
    If l[i]>max then max:=l[i];
  For i:=1 to n do
    If l[i]=max then
    vt:=i;
  Writeln(g,max);
  i:=vt;
  While i>0 do
    Begin
    chon[i]:=true;
    i:=t[i];
    End;
  For i:=1 to n do
    If chon[i]=true then
    Write(g,a[i]:3);
  Close(g);
  End;
Begin
 doctep;
 khoitao;
 xaydung;
 truyvet;
End.
Các bạn sửa lại dùm mình chỗ chuơng trình con xaydung thay vì cho j chạy từ 1 đến i-1 thì sửa lại là For j:=1 to i-h do
https://chuyentinlk.123.st

Thích

Báo xấu [0]

Gửi một bình luận lên tường nhà Admin
Trả lời nhanh
Thu Feb 09, 2012 3:09 pm
Admin
Admin
Admin

Code - Huyền Thoại

Code:
Program Bai1;
 Const  fi = 'bai5.inp';
        fo = 'bai5.out';
 Var t2,t1,a,p,l : Array[0..100] Of Integer;
      chon : Array[1..100] Of Boolean;
  u, n,m,i,j : Integer;
      f,g : Text;
Procedure doctep;
 Var i,j : Integer;
  Begin
  Assign(f,fi);
  Reset(f);
  Readln(f,n,m,u);
  For i:=1 to n do
    Read(f,a[i]);
    Readln(f);
  Close(f);
  End;
Procedure khoitao;
 Var i,j : Integer;
  Begin
  For i:=1 to n do
    Begin
    l[i]:=1;
    p[i]:=1;
    End;
      Fillchar(chon,sizeof(chon),false);
    End;
Function max1(x,y:Integer):Integer;
 Begin
  IF x > y then max1:=x else max1:=y;
 End;

Procedure xaydung;
 Var i,j : Integer;
  Begin
  For i:=2 to n do
  For j:=1 to i-1 do
    If i-j >=m then
      Begin
      If a[i] > a[j] then
      Begin
      If a[i]-a[j] <=u then
        Begin
      l[i]:=max1(1+p[j],l[i]);
      t1[i]:=j;
        End;
        End;
        If a[j] > a[i] then
        Begin
      If a[j]-a[i] <=u then
        Begin
      p[i]:=max1(l[j]+1,p[i]);
      t2[i]:=j;
        End;
        End;
    End;
  End;
Procedure truyvet;
 Var max,vt,i,j:Integer;
  Begin
  Assign(g,fo);
  Rewrite(g);
  max:=0;
  For i:=1 to n do
    If max < l[i] then max:=l[i];
  For i:=1 to n do
    If max=l[i] then vt:=i;
  i:=vt;
  max:=0;
  While i>0 do
    Begin
    chon[i]:=true;
    i:=t1[i];
    End;
  For i:=1 to n do
    If max < p[i] then max:=p[i];
    FOr i:=1 to n do
    If max=p[i] then vt:=i;
  i:=vt;
  While i>0 do
    Begin
    chon[i]:=true;
    i:=t2[i];
    End;
    For i:=1 to n do
    If chon[i]=true then Writeln(g,a[i]);
  Close(g);
  End;
Begin
 doctep;
 khoitao;
 xaydung;
 truyvet;
End.
https://chuyentinlk.123.st

Thích

Báo xấu [0]

Gửi một bình luận lên tường nhà Admin
Trả lời nhanh
Thu Feb 09, 2012 3:49 pm
Admin
Admin
Admin

Code - Huyền Thoại

Code:
Program Bai1;
 Const  fi = 'bai5.inp';
        fo = 'bai5.out';
 Var t,a,l : Array[0..100] Of Integer;
      chon : Array[1..100] Of Boolean;
  p, n,m,i,j : Integer;
      f,g : Text;
Procedure doctep;
 Var i,j : Integer;
  Begin
  Assign(f,fi);
  Reset(f);
  Readln(f,n,p);
  For i:=1 to n do
    Read(f,a[i]);
    Readln(f);
  Close(f);
  End;
Procedure khoitao;
 Var i,j : Integer;
  Begin
  For i:=1 to n do
  l[i]:=sqr(a[i]-p);
  l[1]:=sqr(a[1]-p);
  Fillchar(chon,sizeof(chon),false);
  End;
Procedure xaydung;
 Var i,j : Integer;
  Begin
  For i:=2 to n do
  For j:=1 to i-1 do
  Begin
    If l[i] <= l[j]+sqr(a[i]-a[j]-p) then
      Begin
      l[i]:=l[j]+sqr(a[i]-a[j]-p);
      t[i]:=j;
      End;
  End;
  End;
Procedure truyvet;
 Var max,vt,i,j:Integer;
  Begin
  Assign(g,fo);
  Rewrite(g);
  max:=maxint;
  For i:=1 to n do
    If l[i] < max then max:=l[i];
  For i:=1 to n do
    If l[i]=max then
    vt:=i;
  Writeln(g,max);
  For i:=1 to n do Write(g,l[i]:10);
  i:=vt;
  While i>0 do
    Begin
    chon[i]:=true;
    i:=t[i];
    End;
  Close(g);
  End;
Begin
 doctep;
 khoitao;
 xaydung;
 truyvet;
End.
https://chuyentinlk.123.st

Thích

Báo xấu [0]

Gửi một bình luận lên tường nhà Admin
Trả lời nhanh
Fri Feb 10, 2012 9:29 pm
Admin
Admin
Admin

Code - Huyền Thoại

[wow]
Spoiler:
[/wow]
https://chuyentinlk.123.st

Thích

Báo xấu [0]

Gửi một bình luận lên tường nhà Admin
Trả lời nhanh
Sponsored content

Thích

Báo xấu [0]

Gửi một bình luận lên tường nhà Sponsored content
Trả lời nhanh

Về Đầu TrangThông điệp [Trang 1 trong tổng số 1 trang]

  © FMvi.vn

|_-Diễn Đàn Tin Học - Lê Khiết-_|

« Xem bài trước | Xem bài kế tiếp »

Bài viết liên quan

    Quyền hạn của bạn:

    Bạn không có quyền trả lời bài viết