题解

120 条题解

  • 0
    @ 2009-07-06 08:22:28

    //Jam计数法

    #include

    char JamNum[30], WordList[30];

    int S, T, W;

    int main()

    {

    int i, j, k;

    for(i=1; i

  • 0
    @ 2009-07-02 16:10:42

    晕死,居然看不懂题目。

    看我这土人,居然用了2个小时。。哎,这代码也忒长。。自惭形秽

    好在算一次AC了

    Program jam;

    Var

    s,t,w,k,i,sum:longint;

    st:string;

    flag:boolean;

    num:array[0..255]of byte;

    zm:array[1..26]of char;

    Procedure print;

    var

    i:longint;

    ou:boolean;

    begin

    inc(sum);

    for i:=1 to w do

    write(zm[num[i]]);

    writeln;

    ou:=true;

    for i:=w downto 1 do

    if num[i]t-w+i then begin ou:=false;break; end;

    if ou then halt;

    end;

    Procedure make(k:longint);

    var

    i:longint;

    Begin

    i:=k+1;

    while i

  • 0
    @ 2009-06-12 11:17:52

    var

    a,b,c,max,min:array[1..30] of char;

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

    procedure init;

    begin

    readln(s,t,n);

    for i:=1 to n-1 do

    read(a[i]);

    readln(a[n]);

    for i:=n downto 1 do

    max[i]:=chr(ord('a')+i-n+t-1);

    end;

    begin

    init;

    i:=n;

    j:=0;

    for i:=1 to 5 do begin

    j:=n;

    if ord(a[j]) < ord(max[j]) then begin

    a[j]:=succ(a[j]);

    for k:=1 to n do

    write(a[k]);

    writeln;

    end

    else while a[j]=max[j] do begin

    dec(j);

    if a[j]max[j] then begin

    a[j]:=succ(a[j]);

    for k:=j+1 to n do

    a[k]:=succ(a[k-1]);

    for k:=1 to n do

    write(a[k]);

    writeln;

    break;

    end;

    end;

    end;

    end.

  • 0
    @ 2009-06-08 15:42:53

    一次AC!!

    AC100题纪念!!!

  • 0
    @ 2009-06-07 13:34:25

    没听明白题目在说什么!

  • 0
    @ 2009-05-10 22:56:09

    哪位帮忙看看哪错了? O(∩_∩)O谢谢

    var s,t,w,i,j,k:longint;

    st:string;

    begin

    readln(s,t,w);

    readln(st);

    for k:=1 to 5 do

    for i:=w downto 1 do

    if ord(st[i])+(w-i)

  • 0
    @ 2009-04-29 17:53:06

    var a:array[1..26]of longint;

    s,t,w,i,p,q:longint;

    str:string;

    procedure first;

    begin

    readln(s,t,w);

    readln(str);

    end;

    Begin

    first;

    for i:=1 to w do

    a[i]:=ord(str[i])-96;

    if t-s>w then

    begin

    p:=1;

    while (p

  • 0
    @ 2009-04-18 22:40:58

    var

    s,t,w,i,j,k:longint;

    st:string;

    begin

    readln(s,t,w);

    readln(st);

    for k:=1 to 5 do

    for i:=w downto 1 do

    if ord(st[i])+(w-i)

  • 0
    @ 2009-04-01 17:01:48

    超 易懂 算法

    #include

    using namespace std;

    int s,t,w;

    char mem[27];

    int main()

    {

    cin>>s>>t>>w;

    for(int i=1;i>mem[i];

    mem[0]=s+96-1;

    mem[w+1]=t+96+1;

    for(int i=1;i1)

    { { mem[p]++;ga=true;}

    if(p!=w)

    for(int k=p+1;k

  • 0
    @ 2009-03-21 01:12:28

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    #include "stdio.h"

    int s[100],p,i,j,n,w,t,tt,ss,time=0;

    char m[100];

    void fun()

    {

    while(p>0&&timett) p--;

    else

    if(p==w)

    {

    time++;

    for(i=1;i

  • 0
    @ 2009-03-05 23:57:07

    有点长,不过好歹是自己写的。历史性突破,庆祝一下~~~

    program rqnoj3;

    var

    b,e,l,l1,e1,i,sum,x:longint;

    s:string;

    word,c: array[1..26]of integer;

    begin

    readln(b,e,l);

    readln(s);

    for i:= 1 to l do c[i]:=ord(s[i]);

    for i:= 1 to 26 do word[i]:=ord('a')+i-1;

    l1:=l;

    e1:=e;

    sum:=0;

    repeat

    if c[l1]=word[e1] then repeat dec(l1);dec(e1) until c[l1]

  • 0
    @ 2009-01-21 18:30:04

    92题。。两星半。。顺便鄙视lx的

  • 0
    @ 2008-12-26 23:33:52

    #include

    int next(char s,char t,int w,char*n) {

    int i=w-1,j;

    if(++n[i]=0) {

    if(++n[i]>t) continue;

    for(j=i+1;jt) break;

    if(j==w) return 1;

    } return 0;

    }

    int main() {

    int i,w;

    char s,t,n[26];

    scanf("%d",&i),s=i+'a'-1;

    scanf("%d%d%s",&i,&w,n),t=i+'a'-1;

    for(i=0;i

  • 0
    @ 2008-12-05 21:59:13

    const a:string='abcdefghijklmnopqrstuvwxyz';

    var

    s:array[1..26] of integer;

    i,n,m,k,p,sa,t:integer;

    st,s1:string;

    begin

    readln(n,m,sa);

    readln(st); s1:='';

    for i:=1 to sa do

    begin

    s[i]:=pos(st[i],a);

    end;

    p:=sa; k:=0; t:=1;

    while (p>0)and(k0)and(t=1) then s[p]:=s[p]+1;

    t:=0;

    for i:=1 to p-1 do

    if s[p]=s[i] then t:=1;

    if (p>0)and(t=0)and(p

  • 0
    @ 2008-11-20 19:21:43

    真强啊,话说某人一次AC

  • 0
    @ 2008-11-13 23:05:09

    #include

    #include

    #define LILY 2000

    int s[LILY],p,i,j,k,n,t,w,tt,ss,time;

    char m[LILY];

    int dfs(){

    while(p>0&&timett ) p--;

    else

    if(p==w) {

    t=0;

    for( i=1; i

  • 0
    @ 2008-11-10 11:25:42

    program jamjs;

    var

    a:array[0..26]of integer;

    b:string;

    c,d,e,f,g,h,i:integer;

    begin

    read(c,d,e); readln;

    for f:=1 to e do read(b[f]);

    for f:=1 to e do a[f]:=ord(b[f])-96; g:=0;

    while (a[1]d do

    begin

    for f:=e downto 1 do

    begin

    if (a[f]>d-(e-f)) then

    begin

    a[f-1]:=a[f-1]+1;

    for i:=f to e do

    a[i]:=a+1;

    end;

    end;

    end;

    end;

    for f:=1 to e do write(chr(a[f]+96)); writeln; g:=g+1;

    end;

    if g=5 then break;

    end;

    end.

  • 0
    @ 2008-11-09 13:32:51

    var a:array[1..26]of longint;

    s,t,w,i,p,q:longint;

    str:string;

    procedure first;

    begin

    readln(s,t,w);

    readln(str);

    end;

    Begin

    first;

    for i:=1 to w do

    a[i]:=ord(str[i])-96;

    if t-s>w then

    begin

    p:=1;

    while (p

  • 0
    @ 2008-11-08 11:55:02

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    原先在打完5组数据后忘了退出,结果只过了4组,其余全部超时。

    稍做修改,ac了。

  • 0
    @ 2008-11-08 10:45:23

    20行结束战斗

信息

ID
1318
难度
1
分类
组合数学 点击显示
标签
递交数
2115
已通过
1438
通过率
68%
被复制
24
上传者