题解

265 条题解

  • 0
    @ 2009-07-07 15:55:27

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

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

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

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

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

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

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

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

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

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

    5G 内存那个太逗了。

  • 0
    @ 2009-07-02 17:52:08

    R1289158 Accepted 100 From 木子日匀-

      P1059 FPC Vivid Puppy 2009-7-2 17:51:03

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    运气差...

  • 0
    @ 2009-07-01 19:55:18

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

  • 0
    @ 2009-06-25 19:31:05

    zf那个,内存开太大了,保守估计5G

  • 0
    @ 2009-05-31 18:00:50

    编译通过...

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

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

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

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

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

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

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

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

    ├ 测试数据 09:答案正确... 9ms

    ├ 测试数据 10:答案正确... 9ms

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

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

    program li;

    var i,j,k,n,x,high,max,l:longint;

    f:array[0..15000]of boolean;

    a:array[1..15000]of integer;

    begin

    readln(n);

    f[0]:=true;

    for k:=1 to n do

    begin

    read(x);

    while (x-1) do

    begin

    inc(high,x);

    for i:=high downto 0 do

    if not(f) and (f[i]) then

    begin

    f[x+i]:=true;

    inc(a[x+i]);

    end;

    read(x);

    end;

    if max

  • 0
    @ 2009-05-18 12:33:24

    本题只要将所有可能的高度求出(可以是DP解法),并累加到一个哈希计数中,从最高点扫描哈希计数是否正好等于城堡数量即可.

    在求可能高度时需要考虑的情况有:

    1 积木可以从中间抽出,而不是单纯从上面取.(虽然有点不合理,但仔细看题意应该是这样的)

    2 避免对积木不同组合产生同样高度的重复计数.

    不到30行的代码就可以解决本题.

  • 0
    @ 2009-05-17 23:28:24

    不见得就要用DP吧..

    直接模拟不就好了吗?

    编译通过...

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

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

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

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

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

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

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

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

    ├ 测试数据 09:答案正确... 9ms

    ├ 测试数据 10:答案正确... 9ms

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

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

    program Agent;

    var

    max,cln,n:longint;

    a:array[0..10000]of longint;

    b:array[1..100,1..10000]of boolean;

    procedure init;

    var

    i,x,y,t,k,w:longint;

    begin

    readln(n);

    max:=0;

    for i:= 1 to n do

    begin

    fillchar(a,sizeof(a),0);

    x:=0;

    read(t);

    while t-1 do

    begin

    if not b then

    begin

    b:=true;

    inc(x);

    w:=x-1;

    a[x]:=t;

    if a[x]>max then max:=a[x];

    end

    else w:=x;

    for k:= 0 to w do

    if not b[i,a[k]+t] then

    begin

    b[i,a[k]+t]:=true;

    inc(x);

    a[x]:=a[k]+t;

    if a[x]>max then max:=a[x];

    end;

    read(t);

    end;

    end;

    end;

    function chk(t:longint):boolean;

    var

    i,x,y:longint;

    begin

    for i:= 1 to n do if not b then exit(false);

    exit(true);

    end;

    procedure main;

    var

    i,x,y:longint;

    begin

    cln:=0;

    for i:= max downto 1 do

    if chk(i) then

    begin

    cln:=i;

    break;

    end;

    writeln(cln);

    end;

    begin

    init;

    main;

    end.

  • 0
    @ 2009-05-14 20:30:57

    编译通过...

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

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

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

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

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

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

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

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

    ├ 测试数据 09:答案正确... 244ms

    ├ 测试数据 10:答案正确... 244ms

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

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

    有些慢

  • 0
    @ 2009-04-17 07:14:14

    var n,w,i,j,k,sum:integer;

    a:array[1..10000]of integer; f:array[0..10000]of boolean;

    begin

    readln(n);

    for k:=1 to n do

    begin

    fillchar(f,sizeof(f),false);

    f[0]:=true;

    while j-1 do

    begin

    read(j);

    if j>-1 then

    begin

    sum:=sum+j;

    for i:=sum downto j do

    f[i]:=for f[i];

    end;

    end;

    for i:=1 to sum do

    if f[i] then inc(a[i]);

    sum:=0;

    j:=0;

    end;

    for i:=10000 downto 1 do

    if a[i]=n then

    begin

    writeln(i);

    halt;

    end;

    writeln(0);

    end.

    太奇迹了,终于有一个题是一次AC了。

  • 0
    @ 2009-04-16 18:02:42

    我一把数数组开到array[1..1000,0..32766]of boolean; 就过了

    不知评测数据是怎么的

  • 0
    @ 2009-04-05 14:16:03

    N(N

  • 0
    @ 2009-03-17 18:27:56

    编译通过...

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

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

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

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

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

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

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

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

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

    ├ 测试数据 10:答案正确... 9ms

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

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

    puppy的杰作!55555~~~~~~~~~~~~

  • 0
    @ 2009-03-11 21:16:46

    此程那错了,请神牛赐教,小弟不胜感激!!!!!!!!!!!!!!!!!!!!!

    var f:array[1..1000,0..1000000]of boolean;

    b:array[1..1000,0..1000000]of longint;

    min,sum,i,j,k,n,x:longint;

    ////////////////////////////////////////////////////////////////////////////////

    function ok(x,sum:integer):boolean;

    var i:integer;

    begin

    for i:=1 to n do

    if f then inc(sum);

    exit(sum=n);

    end;

    ////////////////////////////////////////////////////////////////////////////////

    begin

    readln (n); min:=maxint;

    for i:=1 to n do

    begin

    read (x); sum:=0;

    while x-1 do

    begin

    inc(b); inc(sum,x);

    b[i,b]:=x;

    read (x);

    end;

    if min>sum then min:=sum;

    f:=true;

    end;

    for i:=1 to n do

    for j:=1 to min do

    for k:=1 to b do

    if (j>=b)and(f[i,j-b]) then

    begin

    f:=true;

    break;

    end;

    for i:=min downto 1 do

    if ok(i,0) then

    begin

    writeln (i);

    halt;

    end;

    writeln (0);

    end.

  • 0
    @ 2009-03-07 14:32:02

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    遇到了puppy

  • 0
    @ 2009-02-25 19:28:26

    #include

    long n,ins,tall,i,j,k;

    bool map[2][100001];

    int main(){

    scanf("%d",&n);

    tall=100000;

    for(i=0;i=0;k--)

    if(map[1][k]) map[1][k+j]=true;

    scanf("%d",&j);

    }

    if(ins

  • 0
    @ 2009-02-22 18:44:23

    极限优化啊。。。。。。。。。

    用01背包求出各种组合,然后。。。。

    编译通过...

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

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

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

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

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

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

    ├ 测试数据 07:答案正确... 9ms

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

    ├ 测试数据 09:答案正确... 556ms

    ├ 测试数据 10:答案正确... 541ms

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

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

  • 0
    @ 2009-02-18 16:22:43

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

    我交了好多次

    最后的数据判断出了错误!!

    幸亏全秒

    对的起人民

    对得起党!

  • 0
    @ 2009-02-04 16:34:53

    #include

    using namespace std;

    bool f[10002];

    int h[10002];

    main()

    {

    memset(h,0,sizeof(h));

    int n,m;

    cin>>n;

    int max=0;

    for (int k=1;k>t;

    memset(f,false,sizeof(f));f[0]=true;

    while (t!=-1)

    {

    high=HIGH;

    for (int i=high+1;i>=0;i--)

    if (f[i])

    {

    f=true;

    if (i+t>HIGH) HIGH=i+t;

    }

    cin>>t;

    }

    for (int i=0;imax) max=HIGH;

    }

    for (int i=max;i>=0;i--)

    if (h[i]==n)

    {

    cout

  • 0
    @ 2009-02-03 21:47:29

    ..交了无数次

    直接把通过率刷掉1个百分点..

    为什么第5个点过不去

  • 0
    @ 2009-02-01 14:19:06

    汗,我把数组从a[10000]全部变成[10001]就过了第九个数据

    低级错误啊,丢人……

    而且最后一个数据还慢了200MS

    贴个GCC的吧

    #include

    long n,i,j,k,len[101],h[101][101]={0},a[101][10001]={0},l1,l2,d[10001],min;

    int main()

    {

    scanf("%ld",&n);

    min=32767;

    for(i=1;i

信息

ID
1059
难度
6
分类
动态规划 | 背包 点击显示
标签
(无)
递交数
7828
已通过
2342
通过率
30%
被复制
19
上传者