题解

203 条题解

  • 0
    @ 2008-11-11 21:35:49

    。。。交了3次。。。

    初始化数组的那个fillchar。。。打错了顺序。。。

    囧。。。。。。。。。

  • 0
    @ 2008-11-11 21:34:50

    编译通过...

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

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

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

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

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

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

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

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

    你能不能不要乱改格式啊。

  • 0
    @ 2008-11-11 18:20:02

    中间没打‘,’

    ├ 测试数据 01:答案错误...

     ├ Hint: 注意观察样例数据 ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 02:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 03:答案错误...

     ├ Hint: 注意考虑边界情况 ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 04:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 05:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 06:答案错误...

     ├ Hint: 注意考虑边界情况 ├ 标准行输出

     ├ 错误行输出

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

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

    ...................55555555555555

  • 0
    @ 2008-11-11 16:52:28

    哪位大哥帮忙看一下,为什么老错一个点?谢谢

    program daodan;

    var

    a:array[1..21,1..2]of integer;

    i,j,k,n,m:integer;

    s:string;

    procedure work;

    var

    i,k,j,total:integer;

    begin

    total:=n; j:=-1;

    repeat

    k:=maxint;

    for i:=1 to n do

    if k>athen begin k:=a;a:=maxint;dec(total);end;

    inc(j);

    until total=0;

    write(j);

    end;

    procedure work1;

    begin

    readln(s);s:=s+',';

    i:=length(s); j:=1;

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

    for i:=1 to 21 do

    a:=1;

    while i>0do

    begin

    val(copy(s,1,pos(',',s)-1),a[j,1],k);

    inc(j);

    delete(s,1,pos(',',s));

    i:=length(s);

    end;

    n:=j-1;

    for i:=n-1 downto 1 do

    begin

    k:=0;

    for j:=i+1 to n do

    if (a>a[j,1])and(k

  • 0
    @ 2008-11-10 23:23:07

    program daodanlanjie;

    var a:array[0..21]of longint;

    f:array[0..21]of longint;

    i,k,n:integer;

    up,down:longint;

    s:string;

    begin

    read(s);

    i:=1;

    for k:=1 to length(s) do

    if s[k]',' then a[i]:=a[i]*10+ord(s[k])-ord('0')

    else inc(i);

    n:=i;

    for i:=1 to n do f[i]:=1;

    for i:=2 to n do

    for k:=1 to i-1 do

    if (a[i]f[i]) then f[i]:=f[k]+1;

    for i:=1 to n do if f[i]>down then down:=f[i];

    for i:=1 to n do f[i]:=1;

    for i:=2 to n do

    for k:=1 to i-1 do

    if (a[i]>a[k])and(f[k]+1>f[i]) then f[i]:=f[k]+1;

    for i:=1 to n do if f[i]>up then up:=f[i];

    write(down,',',up-1);

    end.

    好久没有一次秒杀了……

  • 0
    @ 2008-11-09 17:04:25

    编译通过...

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

    ├ 测试数据 02:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 03:答案错误...

     ├ Hint: 注意考虑边界情况 ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 04:答案错误... ├ 标准行输出

     ├ 错误行输出

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

    ├ 测试数据 06:答案错误...

     ├ Hint: 注意考虑边界情况 ├ 标准行输出

     ├ 错误行输出

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

    测试数据是不是有问题呀???

    怎么会有输出1,0的呢???

    难道还会有最多能打1个导弹却需要0套设备的情况???

    出题人是外星球来的吧。。。

  • 0
    @ 2008-11-12 18:53:47

    编译通过...

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

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

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

    ├ 测试数据 04:答案错误...

     ├ 标准行输出

     ├ 错误行输出

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

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

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

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

    贪心有错(数据也太弱了,居然过了5个)

    大牛举了反例 6 5 1 7 3 2

    编译通过...

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

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

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

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

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

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

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

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

    用最长上升子序列 AC

  • 0
    @ 2008-11-07 20:09:04

    输入好难写啊! 我要被烦死了!

  • 0
    @ 2008-11-06 22:18:21

    哎,居然读入有逗号,输出也不同,…………教训啊

  • 0
    @ 2008-11-05 21:51:00

    编译通过...

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

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

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

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

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

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

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

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

    program hly;

    const max=100;

    var

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

    s:string;

    n,ans1,ans2:longint;

    procedure init;

    var

    i,start,finish:longint;

    begin

    readln(s);

    start:=1;finish:=1;

    n:=0;

    for i:=1 to length(s) do

    begin

    if s[i]=',' then

    begin

    finish:=i-1;

    inc(n);

    val(copy(s,start,finish-start+1),a[n]);

    start:=i+1;

    end;

    if i=length(s) then

    begin

    finish:=i;

    inc(n);

    val(copy(s,start,finish-start+1),a[n]);

    end;

    end;

    for i:=1 to n do

    begin

    b[i]:=1;c[i]:=1;

    end;

    end;

    procedure work1;

    var

    i,j,max:longint;

    begin

    for i:=2 to n do

    begin

    max:=0;

    for j:=1 to i-1 do

    if (a[j]>a[i]) and (b[j]>max) then

    max:=b[j];

    b[i]:=b[i]+max;

    end;

    max:=0;

    for i:=1 to n do

    if b[i]>max then max:=b[i];

    ans1:=max;

    end;

    procedure work2;

    var

    i,j,min,max,id,ss:longint;

    begin

    for i:=1 to n do

    c[i]:=0;

    id:=1;

    for i:=1 to n do

    begin

    min:=maxlongint;

    max:=-1;ss:=0;

    for j:=1 to id do

    begin

    if c[j]>max then max:=c[j];

    if c[j]=0 then begin c[j]:=a[i]; max:=c[j];break; end;

    if (c[j]-a[i]0) then begin min:=c[j]-a[i];ss:=j;end;

    end;

    if ss0 then c[ss]:=a[i];

    if a[i]>max then begin inc(id);c[id]:=a[i]; end;

    end;

    ans2:=id-1;

    end;

    begin

    init;

    work1;

    work2;

    writeln(ans1,',',ans2);

    end.

  • 0
    @ 2008-11-03 21:55:04

    可用动态规划

  • 0
    @ 2008-11-03 18:37:40

    第二问其实可以最小路径覆盖

  • 0
    @ 2008-11-03 16:58:05

    之前第一问是用最长不升做 第二问就是一直做到全串为空.

    后面看了才知道第二问可以用求最长升序列来做.

    哪个大牛可以解释,或者发证明的式子给我~THANKS

  • 0
    @ 2008-11-03 11:14:25

    最长子序列问题么...

    我汗

  • 0
    @ 2008-11-02 23:37:37

    编译通过...

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

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

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

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

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

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

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

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

    很弱的题

  • 0
    @ 2008-11-02 11:34:51

    逗号用C怎么读啊……

  • 0
    @ 2008-11-02 00:01:18

    痛快1次ac

  • 0
    @ 2008-11-01 21:38:25

    编译通过...

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

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

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

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

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

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

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

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

    program daodan;

    var h,len,sys:array[0..21] of integer;

    dao:string;

    j,k,i,total,max,min,sl:longint;

    begin

    readln(dao);

    i:=1;total:=1;

    while length(dao)>=i do

    if (dao[i]=',') then begin i:=i+1; total:=total+1;end

    else begin h[total]:=h[total]*10+ord(dao[i])-48; i:=i+1;end;

    len[1]:=1;

    for i:=2 to total do begin

    len[i]:=1;max:=0;

    for j:=1 to i-1 do

    if h[j]>=h[i] then

    if len[j]>max then max:=len[j];

    len[i]:=max+1;

    end;max:=0;

    for i:=1 to total do if len[i]>max then max:=len[i];

    k:=1;sys[1]:=h[1];

    for i:=2 to total do begin

    min:=maxint;

    for j:=1 to k do if sys[j]>h[i] then

    if sys[j]

  • 0
    @ 2008-10-30 19:44:35

    有没有 2nlgn 的 简短 的 算法

    !!!!!!!!!!!!!!!

  • 0
    @ 2008-10-30 19:03:18

    强烈BS

    题目有问题

信息

ID
1303
难度
6
分类
动态规划 | 单调性DP 点击显示
标签
递交数
7583
已通过
2014
通过率
27%
被复制
11
上传者