PersonalCorpus 版 (精华区)

159843 01:52:03 11 Mar 2002
Bozhang,HIT,P.R.China 1081 Pascal Accepted 0.02 sec 49K

var
    a:array[1..43,0..1] of integer;
    i,j,k,n:integer;
begin
    readln(n,k);
    a[1,0]:=1; a[1,1]:=1;
    for i:=2 to n do begin
        a[i,0]:=a[i-1,0]+a[i-1,1];
        a[i,1]:=a[i-1,0];
    end;
    if k>a[n,0]+a[n,1] then begin
        writeln(-1);
    end else for i:=n downto 1 do
        if k>a[i,0] then begin write(1); k:=k-a[i,0] end else write(0);
end.
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:4.514毫秒