95 条题解

  • 0
    @ 2009-03-23 20:56:51

    压位高精就是快……

    我先前压五位,错两个点,发现循环时变量没自加,改过来,有一个点内存溢出,把数组开大,两个点溢出。无奈,改成压八位,AC……

  • 0
    @ 2009-03-23 19:45:01

    编译通过...

    ├ 测试数据 01:答案正确... 72ms

    ├ 测试数据 02:答案正确... 56ms

    ├ 测试数据 03:答案正确... 72ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:200ms

    貌似用结构体写的高精度会比较慢..

  • 0
    @ 2009-02-14 16:44:41

    显然是先算好 O(N)输出 的

    我竟然脑残的对每个N求了一次

    怪不得无限超时..

  • 0
    @ 2009-02-05 20:47:45

    由于2k+1和2k的方案数相同,因此我们用f[k]表示2k+1和2k的方案数。则:

    f[k]=f[k-1]+f[k div 2]

    然后在用高精度计算即可。要用9位压缩……

    纪念我的第500次提交,第248题AC。

    附上Vijos Dolphin评测记录:

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 25ms

    ├ 测试数据 03:答案正确... 25ms

    看来这个算法很快了……

  • 0
    @ 2009-02-05 16:24:53

    while ans[k]=0 do dec(k);

    write(ans[k]);

    for i:=k-1 downto 1 do

    if ans[i]

  • 0
    @ 2008-11-13 14:57:16

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:778ms

    ---|---|---|---|---|---|---|---|-

    Remember:

    1.内存只能开1500000的longint.

    2.不止一组数据.

    3.先做再输.

    4......不要放弃啊

  • 0
    @ 2008-11-13 14:51:13

    ├ 测试数据 01:运行超时|格式错误...

    ├ 测试数据 02:运行超时|格式错误...

    ├ 测试数据 03:运行超时|格式错误...

    ---|---|---|---|---|---|---|---|---|---|---|-

    改了好长时间,现在才发现居然不止一组测试数据

    ---|---|---|---|---|---|---|---|---|---|---|-编译通过...

    ├ 测试数据 01:内存溢出...

    ├ 测试数据 02:内存溢出...

    ├ 测试数据 03:内存溢出...

    ---|---|---|---|---|---|---|---|---|---|---|-

    居然如此整齐的内存益出.

    编译通过...

    ├ 测试数据 01:答案正确... 134ms

    ├ 测试数据 02:答案正确... 134ms

    ├ 测试数据 03:答案正确... 103ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:371ms

  • 0
    @ 2008-10-28 21:54:24

    无语了 压缩了还超`\

    program p1136;

    {online}

    var

    k,w,n,l1,l2,i,j,x,y:longint;

    a,b:array[1..100] of longint;

    p:ansistring;

    function add(s1,s2:ansistring):string;{inline}

    begin

    add:='';

    l1:=length(s1);

    l2:=length(s2);

    x:=1;

    while (l1>8) do begin

    p:=copy(s1,l1-7,8);

    val(p,a[x],w);

    l1:=l1-8;

    inc(x);

    end;

    p:=copy(s1,1,l1);

    val(p,a[x],w);

    y:=1;

    while (l2>8) do begin

    p:=copy(s2,l2-7,8);

    val(p,b[y],w);

    l2:=l2-8;

    inc(y);

    end;

    p:=copy(s2,1,l2);

    val(p,b[y],w);

    if x0 then begin

    str(w,p);

    add:=p+add;

    end;

    j:=1;

    while (add[j]='0') do inc(j);

    add:=copy(add,j,length(add)-j+1);

    end;

    function f(t:longint):ansistring;{inline}

    begin

    if (t=0) or (t=1) then exit('1');

    if t and 1=0 then f:=add(f(t-1),f(t shr 1))

    else f:=f(t-1);

    end;

    begin

    while not(eoln) do begin

    readln(n);

    writeln(f(n));

    end;

    end.

  • 0
    @ 2008-10-01 20:09:07

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 88ms

    ├ 测试数据 03:答案正确... 56ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:144ms

    好慢...没法秒杀[没魔了,打不出暗影突袭]=.=

  • 0
    @ 2008-09-30 17:43:20

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 72ms

    ├ 测试数据 03:答案正确... 41ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:113ms

    不快不慢。数组太大在debug时单步执行要费老长时间。

  • 0
    @ 2008-09-30 14:56:49

    不要忘了f[0].........

  • 0
    @ 2008-09-18 17:20:19

    编译通过...

    ├ 测试数据 01:答案正确... 166ms

    ├ 测试数据 02:答案正确... 181ms

    ├ 测试数据 03:答案正确... 181ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:528ms

    我的怎么就慢一些。。。。

  • 0
    @ 2008-09-17 23:13:33

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 41ms

    ├ 测试数据 03:答案正确... 41ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:82ms

    program vijos1136;

    //---|---|---|---|---|---|---|---|---|---|---|--

    type

    arr=array[0..6]of longint;

    const

    nmax=3000000;

    max=1000000000;

    var

    f:array[0..nmax shr 1]of arr;

    n,i,j,now,len:longint;

    s:string;

    //---|---|---|---|---|---|---|---|---|---|---|--

    function getmax(a,b:longint):longint;

    begin

    if a>=b then exit(a);

    exit(b);

    end;

    //---|---|---|---|---|---|---|---|---|---|---|--

    procedure calc(var a:arr; b,c:arr);

    var

    i,jw,x:longint;

    begin

    jw:=0;

    for i:=1 to getmax(b[0],c[0]) do begin

    x:=b[i]+c[i]+jw;

    jw:=x div max;

    a[i]:=x mod max;

    end;

    a[0]:=i;

    if jw0 then begin

    a:=jw; inc(a[0]);

    end;

    end;

    //---|---|---|---|---|---|---|---|---|---|---|--

    begin

    f[0,1]:=1;

    f[0,0]:=1;

    now:=0;

    while not eof do begin

    readln(n);

    n:=n shr 1;

    if n>now then begin

    for i:=now+1 to n do

    calc(f[i],f,f[i shr 1]);

    now:=n;

    end;

    len:=f[n,0];

    for i:=len downto 1 do begin

    if f[n,i]0 then begin

    str(f[n,i],s);

    if (length(s)

  • 0
    @ 2008-09-17 23:10:44

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 88ms

    ├ 测试数据 03:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:88ms

  • 0
    @ 2008-09-02 13:21:14

    ├ 测试数据 01:答案正确... 431ms

    ├ 测试数据 02:答案正确... 447ms

    ├ 测试数据 03:答案正确... 291ms

    教训啊!!!高精度一定要longint!!

    只存偶数,f[i]:=f+f[i shr 1],1

  • 0
    @ 2008-08-07 14:30:57

    编译通过...

    ├ 测试数据 01:答案正确... 56ms

    ├ 测试数据 02:答案正确... 103ms

    ├ 测试数据 03:答案正确... 88ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:247ms

    这是PUPPY

    编译通过...

    ├ 测试数据 01:运行超时...

    ├ 测试数据 02:运行超时...

    ├ 测试数据 03:运行超时...

    ---|---|---|---|---|---|---|---|-

    Unaccepted 有效得分:0 有效耗时:0ms

    这是DOLPHIN

    相同的程序,差距怎么就这么大呢?

  • 0
    @ 2008-07-22 19:46:01

    把住高楼的同志的语录编辑了一下:

    很险的一个高精度,要9压位,逢10亿进位时不要用一个变量转接,最好是加

    上前一个div 1000000000而不是在前一步时用某个变量假如

    e:=。。div 1000000000,这样要多耗费时间,还有方程变为

    f[i]:=f+f[i div 2];这是原来奇偶都算进的方程,也是只算偶数时的

    方程,最后输出f[n div 2]

    注意有多个数据,否则格式错误,用while not eof do

  • 0
    @ 2007-12-21 17:59:38

    编译通过...

    ├ 测试数据 01:答案正确... 134ms

    ├ 测试数据 02:答案正确... 134ms

    ├ 测试数据 03:答案正确... 119ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:387ms

    我终于明白为什么

    通过   94人

    提交   1230次

    通过率   8%

    难度   2

    因为!"包含多个测试数据,每行是一个整数n(1

  • 0
    @ 2007-11-21 14:04:29

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 25ms

    ├ 测试数据 03:答案正确... 88ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:113ms

  • 0
    @ 2007-10-24 14:27:28

    高精压位。最好压8~9位,预处理,空间反复利用。空间开销就是150万*6,然后就是离线算法的回答询问O(1)搞定。

信息

ID
1136
难度
8
分类
递推 | 高精度 点击显示
标签
(无)
递交数
3320
已通过
499
通过率
15%
被复制
4
上传者