159 条题解

  • 0
    @ 2009-07-13 22:28:40

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    var

    p1,p2,p3,i,k,p11:longint;

    a,b,j:char;

    s:string;

    begin

    readln(p1,p2,p3);

    readln(s);

    for i:=1 to length(s) do

    begin

    p11:=0; a:=s; b:=s;

    if (s[i] in['a'..'z'])or(s[i] in['0'..'9']) then begin write(s[i]); continue end;

    if (abs(ord(a)-ord(b))>25)or(a='-')or(b='-')or(b

  • 0
    @ 2009-07-13 09:52:07

    var p1,p2,p3,i,k,y,l:integer;

    j:char;

    f:boolean;

    kg:array[-2..10001] of integer;

    s,x,ins,ins2:ansistring;

    procedure kgs;

    var k,i:integer;

    begin

    k:=0;

    for i:=1 to length(s) do

    if s[i]='-' then begin inc(k); kg[k]:=i; end;

    end;

    begin

    readln(p1,p2,p3);

    readln(s);

    x:=s;

    repeat

    k:=pos('-',x);

    inc(y);

    f:=false;

    delete(x,k,1);

    kgs;

    if (k0) and (k1) then begin

    k:=kg[y];

    if (ord(s[k+1])>47) and (ord(s[k+1])47) and (ord(s[k-1])96) and (ord(s[k+1])96) and (ord(s[k-1])ord(s[k-1])

    then if (f)and (k1)then

    begin if ord(s[k-1])+1=ord(s[k+1]) then begin delete(s,k,1); dec(y); end

    else begin ins2:=''; ins:='';

    for j:=chr(ord(s[k-1])+1) to chr(ord(s[k+1])-1) do

    for i:=1 to p2 do begin

    if p13 then begin

    if ord(j)>58 then begin

    if p1=1 then ins:=ins+j;

    if p1=2 then ins:=ins+chr(ord(j)-32); end;

    if ord(j)

  • 0
    @ 2009-07-02 17:56:42

    program strzk;

    var

    p1,p2,p3:shortint;

    i,j,jjj,k,n:longint;

    s:array[1..256]of string;

    jls:array[1..256]of boolean;

    ss,s1,s2:string;

    jj:char;

    begin

    readln(p1,p2,p3);

    readln(ss);

    n:=length(ss);

    fillchar(jls,sizeof(jls),false);

    for i:=1 to n do s[i]:=ss[i];

    for i:=2 to n-1 do

    begin

    if (s[i]='-')and(length(s)=1)and(length(s)=1) then

    begin

    if succ(s)=s then s[i]:=''

    else

    begin

    if s>s then

    begin

    k:=0;

    if (s in ['a'..'z'])and(s in ['a'..'z'])then k:=1;

    if (s in ['0'..'9'])and(s in ['0'..'9'])then k:=2;

    if k=1 then

    begin

    case p1 of

    1:begin

    s1:='';

    for jj:=succ(s) to pred(s) do

    for j:=1 to p2 do

    s1:=s1+jj;

    end;

    2:begin

    s1:='';

    for jj:=succ(chr(ord(s)-32)) to pred(chr(ord(s)-32)) do

    for j:=1 to p2 do

    s1:=s1+jj;

    end;

    3:begin

    s1:='';

    for j:=1 to (ord(s)-ord(s)-1) do

    for jjj:=1 to p2 do

    s1:=s1+'*'

    end;

    end;

    if (p3=2) then jls[i]:=true;

    s[i]:=s1;

    end;

    if k=2 then

    begin

    case p1 of

    1,2:begin

    s1:='';

    for jj:=succ(s) to pred(s) do

    for j:=1 to p2 do

    s1:=s1+jj;

    end;

    3:begin

    s1:='';

    for jj:=succ(s) to pred(s) do

    for jjj:=1 to p2 do

    s1:=s1+'*';

    end;

    end;

    if p3=2 then jls[i]:=true;

    s[i]:=s1;

    end;

    end;

    end;

    end;

    end;

    for i:=1 to n do

    begin

    if jls[i] then

    begin

    for j:=length(s[i]) downto 1 do write(s);

    end

    else write(s[i]);

    end;

    end.

    真长。。。。

  • 0
    @ 2009-06-19 00:30:24

    看到这一行红字,很欣慰,一晚上....

    细节决定成败!

    仔细看题先!

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

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    var p1,p2,p3,i:longint;

    s,t:string;

    ab,ma,num:set of char;

    procedure find(a,b:char;m:Longint);

    var i,x,y:char;k:string;j:longint;

    begin

    k:='';

    case p1 of

    1:

    begin

    x:=a;y:=b;

    for i:=succ(x) to pred(y) do

    for j:=1 to p2 do

    begin

    k:=k+i;

    end;

    if p3=1 then

    begin

    write(k);

    end

    else

    begin

    for j:=1 to length(k) do

    begin

    write(k[length(k)-j+1]);

    end;

    end;

    end;

    2:

    begin

    x:=a;y:=b;

    if m3 then

    begin

    x:=upcase(a);

    y:=upcase(b);

    end;

    for i:=succ(x) to pred(y) do

    for j:=1 to p2 do

    begin

    k:=k+i;

    end;

    if p3=1 then

    begin

    write(k);

    end

    else

    begin

    for j:=1 to length(k) do

    begin

    write(k[length(k)-j+1]);

    end;

    end;

    end;

    3:

    begin

    for i:=succ(a) to pred(b) do

    for j:=1 to p2 do

    begin

    write('*');

    end;

    end;

    end;

    end;

    begin

    readln(p1,p2,p3);

    readln(s);

    ab:=['a'..'z'];

    num:=['0'..'9'];

    for i:=1 to length(s) do

    begin

    if (s[i]='-')and(i1)and(ilength(s))and(ss)and(s

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

    嘿嘿,C++的find(),insert(),replace()这几个成员函数真是方便

    我在《中小学电脑报noi专刊》07年12月20日的第10期写了NOIP07的题解。里面有这道题。

    除了那两个头尾有减号的恶心数据,应该没什么别的难点吧?

  • 0
    @ 2009-05-21 21:59:37

    重要提示:1.开头有两组数据有一个‘-’,还有一组数据有两个‘-’!!!

    2.注意:9-a-9时,两个‘-’都不能去!!!!!

    以上均是我通过自己的错误总结出来的经验,不看你一定会吃大亏的!!!!!!!

  • 0
    @ 2009-05-17 09:53:08

    program ex;

    var p1,p2,p3,len,i:longint;

    s:string;

    procedure init;

    begin

    readln(p1,p2,p3);

    readln(s);

    end;

    procedure exam1;

    var i,k:longint;

    begin

    if p3=1 then

    for i:= ( ord(s[len-1])+1) to ( ord(s[len+1])-1) do

    for k:=1 to p2 do

    write(chr(i));

    if p3=2 then

    for i:=ord(s[len+1])-1 downto ord(s[len-1])+1 do

    for k:=1 to p2 do

    write(chr(i));

    end;

    procedure exam2;

    var i,k:longint;

    begin

    if p3=1 then

    for i:=ord(s[len-1])+1 to ord(s[len+1])-1 do

    for k:=1 to p2 do

    begin

    if (ord(s[len-1])>=ord('a'))then write(chr(i-32))

    else write(chr(i));

    end;

    if p3=2 then

    for i:=ord(s[len+1])-1 downto ord(s[len-1])+1 do

    for k:=1 to p2 do

    begin

    if (ord(s[len-1])>=ord('a')) then write(chr(i-32))

    else write(chr(i));

    end;

    end;

    procedure exam3;

    var i,k:longint;

    begin

    if p3=1 then

    for i:=ord(s[len-1])+1 to ord(s[len+1])-1 do

    for k:=1 to p2 do

    write ('*');

    end;

    procedure exam4;

    var i:longint;

    begin

    repeat

    len:=pos('-',s);

    for i:=1 to len-1 do write(s[i]);

    if len=1 then write('-') else

    if len=length(s) then halt else

    if ( ( ord(s[len-1])>=ord('a') ) and ( ord(s[len+1])=ord('a') ) and ( ord(s[len-1])= (ord(s[len+1])) then write('-') else

    if p1=1 then exam1 else

    if p1=2 then exam2 else

    if p1=3 then exam3;

    delete(s,1,len);

    until s='';

    end;

    begin

    init;

    s:=s+'-';

    exam4;

    end.

    牛牛帮我看下 怎么才80分 过不了????

  • 0
    @ 2009-04-12 13:14:23

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    做起来好复杂!

  • 0
    @ 2009-04-04 22:37:31

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    看似简单的一题耗了我一晚上;

    审题很重要!!!!!!!!!!!!!!!!!

  • 0
    @ 2009-03-17 17:53:18

    居然忘记给判断变量赋值,无语啊......

    program dl;

    var p1,p2,p3,i,j,m,l,zo,v,z,y,js:integer;

    s,bz,s1,s2:ansistring;

    shu,zi:set of 48..135;

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

    begin

    readln(p1,p2,p3); readln(s); l:=length(s); v:=0; i:=1;

    shu:=[48..57]; zi:=[65..122];

    j:=l;

    repeat

    dec(j);

    if s[j]='-' then

    begin a[i]:=j; inc(i); end;

    until j=1;

    for z:=1 to i-1 do

    begin

    v:=0;

    m:=ord(s[a[z]]); zo:=ord(s[a[z]-1]); y:=ord(s[a[z]+1]);

    if ((zo in zi) and (y in zi) and (zo

  • 0
    @ 2009-02-28 16:53:20

    第一次 粗心

    第二次 贪便宜

    第三次 AC

    105行CODE 不贪便宜了^

  • 0
    @ 2009-02-05 16:26:38

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    var

    i,j,k,n,m,o,rp:longint;

    s,c,ss:ansistring;

    begin

    readln(n,m,k);

    readln(s);

    i:=0;

    while is))or((s='0')and(s='0')and(s>s))

    then begin

    c:='';

    for j:=ord(s)+1 to ord(s)-1 do

    c:=c+chr(j);

    if (n=2)and(s>='a')

    then begin

    for j:=1 to length(c) do

    c[j]:=chr(ord(c[j])-32);

    end;

    delete(s,i,1);

    if n=3

    then begin

    for j:=1 to length(c) do

    c[j]:='*';

    end;

    if k=2

    then begin

    ss:='';

    for j:=1 to length(c) do

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

    c:='';

    for j:=1 to length(ss) do

    c:=c+copy(ss,j,1);

    end;

    ss:='';

    for j:=1 to length(c) do

    for o:=1 to m do

    ss:=ss+c[j];

    insert(ss,s,i);

    end;

    end;

    writeln(s);

    end.

    46 行代码 AC

    注意细节就行了。。

  • 0
    @ 2009-02-04 16:24:20

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    就是长点

  • 0
    @ 2009-02-03 19:43:31

    温馨提示:1、有可能存在连续的减号;

    2、字符串头尾有可能有减号;

    3、认真审题;

    4、仔细检查;

    5、没了;

  • 0
    @ 2009-01-24 14:14:41

    program expand;

    var s,b,c:string;

    p1,p2,p3,t:integer;

    procedure int;

    begin

    read(p1,p2,p3);

    read(s);

    end;

    procedure expan1(x:integer;s1,s2:char; var n:integer);

    var i,j:integer;

    begin

    n:=ord(s2)-ord(s1);

    if x=1 then begin

    c[1]:=s1;

    for i:=2 to n do

    c[i]:=succ(c);

    end;

    if x=2 then begin

    c[1]:=upcase(s1);

    for i:=2 to n do

    c[i]:=succ(c);

    end;

    if x=3 then begin

    c[1]:='*';

    for i:=2 to n do

    c[i]:='*';

    end;

    end;

    procedure expan2(x,n:integer; var len:integer);

    var i,j,k:integer;

    d:string;

    begin

    k:=1;

    for i:=2 to n do

    for j:=1 to x do begin

    c[k]:=c[i];

    inc(k);

    end;

    len:=length(d);

    c:=d;

    end;

    procedure expan3(x,n,p:integer);

    var i:integer;

    begin

    if x=1 then

    for i:=1 to p do

    b[t+i-1]:=c[i];

    if x=2 then

    for i:=p downto 1 do

    b[t+p-i]:=c[i];

    end;

    procedure dg;

    var i,j,len,r,p:integer;

    q:boolean;

    begin

    len:=length(s);

    t:=1; i:=1;

    while i

  • 0
    @ 2009-01-17 11:10:53

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    猥琐~~累死~~~ 开始写37行 60分,改完46行,AC~

  • 0
    @ 2009-01-01 23:00:20

    此题黠甚。。。忽略了两点:

    1 字母的ASC大于数字

    2 生成串长度可能超过255

    于是,我的AC率。。。

    [许多特殊情况可以不另外写,乖乖地只处理他要处理的那些就行了]

    丑陋的代码:

    program expand;

    var

    st,str:ansistring;

    a,l,i,j,k,p1,p2,p3:integer;

    begin;

    readln(p1,p2,p3);

    readln(st);

    l:=length(st);

    str:='';

    for i:=1 to l do begin

    str:=str+st[i];

    if (st[i]='-') and (st>st) then begin

    if (st in ['0'..'9']) and (st in ['0'..'9']) then begin

    delete(str,length(str),1);

    a:=ord(st)-ord(st)-1;

    if p1=3 then for j:=1 to p2*a do str:=str+'*'

    else if p3=1 then for j:=1 to a do for k:=1 to p2 do

    str:=str+chr(ord(st)+j)

    else for j:=a downto 1 do for k:=1 to p2 do

    str:=str+chr(ord(st)+j);

    end;

    if (st in ['A'..'Z']) and (st in ['A'..'Z']) then begin

    delete(str,length(str),1);

    a:=ord(st)-ord(st)-1;

    if p1=3 then for j:=1 to p2*a do str:=str+'*';

    if p1=1 then

    if p3=1 then for j:=1 to a do

    for k:=1 to p2 do str:=str+chr(ord(st)+32+j)

    else for j:=a downto 1 do

    for k:=1 to p2 do str:=str+chr(ord(st)+32+j);

    if p1=2 then

    if p3=1 then for j:=1 to a do

    for k:=1 to p2 do str:=str+chr(ord(st)+j)

    else if p3=2 then for j:=a downto 1 do

    for k:=1 to p2 do str:=str+chr(ord(st)+j);

    end;

    if (st in ['a'..'z']) and (st in ['a'..'z']) then begin

    delete(str,length(str),1);

    a:=ord(st)-ord(st)-1;

    if p1=3 then for j:=1 to p2*a do str:=str+'*';

    if p1=1 then

    if p3=1 then for j:=1 to a do

    for k:=1 to p2 do str:=str+chr(ord(st)+j)

    else for j:=a downto 1 do

    for k:=1 to p2 do str:=str+chr(ord(st)+j);

    if p1=2 then

    if p3=1 then for j:=1 to a do

    for k:=1 to p2 do str:=str+chr(ord(st)-32+j)

    else for j:=a downto 1 do

    for k:=1 to p2 do str:=str+chr(ord(st)-32+j);

    end;

    end;

    end;

    writeln(str);

    end.

  • 0
    @ 2008-12-20 14:32:05

    第7组 标准行输出:-z-l...

    错误行输出:***|*...

    这是什么意思?

    注意了开头和结尾为‘-’还是一样的结果,这是错在哪?

    疯了,用下面几位大牛的提交,第6组还是错了`\
    我的AC率\
    `

    BS这题,下面几位的试过了,最少的只过了5个

  • 0
    @ 2008-12-01 21:59:12

    一次ac.

    看清楚题目就行了.

    Program expand;

    Var

    p1,p2,p3,i,sign:LongInt;

    s:AnsiString;

    s0,s00,st:AnsiString;

    ch1,ch2:Char;

    Function ts:Boolean;

    Begin

    If (Ord(ch2)-Ord(ch1)>1) And (

    ( (Ord(ch1)=97) ) )

    Then ts:=True Else ts:=False;

    End;

    Function pd:Boolean;

    Begin

    If pos('-',s)=0 Then pd:=True Else pd:=False;

    End;

    Procedure Finish;

    Begin

    st:=Copy(s,1,sign-1);

    st:=st+s0;

    st:=st+Copy(s,sign+1,length(s));

    s:=st;

    End;

    Procedure Main;

    Var

    i,j:LongInt;

    Begin

    sign:=pos('-',s);

    If sign=1 Then Begin

    s0:='@';

    Finish;

    Exit;

    End;

    ch1:=s[sign-1];

    ch2:=s[sign+1];

    s0:='';st:='';

    If ts Then Begin

    Case p1 Of

    1: For i:=Ord(ch1)+1 To Ord(ch2)-1 Do

    For j:=1 To p2 Do s0:=s0+Chr(i);

    2: If Ord(ch1)

  • 0
    @ 2008-11-28 20:29:35

    编译通过...

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

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

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

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

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

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

     ├ 标准行输出

     ├ 错误行输出

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

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

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

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

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

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

    program expand;

    var s:string;

    p1,p2,p3,len,i,j:integer;

    d:boolean;

    procedure print(a1,a2:integer);

    var i,k,j:integer;

    begin

    k:=a2-a1-1;

    if p1=3 then

    begin

    for i:=1 to k*p2 do write('*'); exit; end;

    if p3=1 then

    for i:=1 to k do

    for j:=1 to p2 do

    begin

    if p1=1then

    begin if d=true then write(chr(a1-65+97+i));

    if d=false then write(chr(a1+i)); end;

    if p1=2 then

    begin if d=true then write(chr(a1+i));

    if d=false then write(chr(a1-97+65+i)); end;

    end;

    if p3=2 then

    for i:=k downto 1 do

    for j:=1 to p2 do

    begin

    if p1=1then

    begin if d=true then write(chr(a1-65+97+i));

    if d=false then write(chr(a1+i)); end;

    if p1=2 then

    begin if d=true then write(chr(a1+i));

    if d=false then write(chr(a1-97+65+i)); end;

    end; end;

    procedure doing(n:integer);

    var i,j,a1,a2:integer;

    begin

    a1:=ord(s[n-1]);a2:=ord(s[n+1]);

    if (a1>=a2) then begin write('-');exit; end;

    if a2-1=a1 then exit;

    if (a1>47)and(a147)and(a264)and(a164)and(a2=97)and(a1=97)and(a2

信息

ID
1379
难度
6
分类
模拟 点击显示
标签
递交数
5989
已通过
1615
通过率
27%
被复制
10
上传者