题解

281 条题解

  • 0
    @ 2009-11-08 21:32:42

    var

    b:string; lcx:char; i,s,j:longint; a:array[1..10] of integer;

    begin

    s:=0; j:=0;

    for i:=1 to 13 do

    begin read(lcx); if lcx'-' then begin inc(j); a[j]:=ord(lcx)-ord('0'); end; b[i]:=lcx; end;

    for i:=1 to 9 do s:=s+a[i]*i;

    s:=s mod 11;

    if s=10 then lcx:='X'

    else lcx:=chr(s+ord('0'));

    if lcx=b[13] then write('Right')

    else begin b[13]:=lcx; for i:=1 to 13 do write(b[i]); end;

    end.

  • 0
    @ 2009-11-08 21:21:31

    我的题解 - My Solution别说你没看见

    program asfl;var s:string; i,j,b:longint; a:array[1..10]of longint;begin readln(s); i:=1; j:=1; while i

  • 0
    @ 2009-11-08 20:03:18

    #include

    using namespace std;

    int main()

    {

    char isbn[13];

    int a,b,c,d,e,f,g,h,i,j;

    cin>>isbn;

    a=isbn[0]-48;

    b=isbn[2]-48;

    c=isbn[3]-48;

    d=isbn[4]-48;

    e=isbn[6]-48;

    f=isbn[7]-48;

    g=isbn[8]-48;

    h=isbn[9]-48;

    i=isbn[10]-48;

    j=isbn[12]-48;

    if ((a*1+b*2+c*3+d*4+e*5+f*6+g*7+h*8+i*9)%11

  • 0
    @ 2009-11-06 08:32:16

    为什么?

    像ls一样用了一个p就对了。。

    编译通过...

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

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

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

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

    ├ 测试数据 05:运行超时|无输出...

    ├ 测试数据 06:运行超时|无输出...

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

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

    ├ 测试数据 09:运行超时|无输出...

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

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

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

    #include "stdio.h"

    int main()

    {

    int i,sbm=0;

    char c[13]={'\0'};

    scanf("%s",c);

    sbm+=(c[0]-'0')*1+(c[2]-'0')*2+(c[3]-'0')*3;

    sbm+=(c[4]-'0')*4+(c[6]-'0')*5+(c[7]-'0')*6;

    sbm+=(c[8]-'0')*7+(c[9]-'0')*8+(c[10]-'0')*9;

    if(sbm%11==10)

    {

    if(c[12]=='X')

    printf("Right");

    }

    else if(sbm%11==c[12]-'0')

    printf("Right");

    else

    {

    for(i=0;i

  • 0
    @ 2009-11-03 21:08:43

    #include

    using namespace std;

    int main(void)

    {

    string s;

    cin>>s;

    int ans=0;

    ans=ans+(s[0]-'0')*1;

    ans=ans+(s[2]-'0')*2;

    ans=ans+(s[3]-'0')*3;

    ans=ans+(s[4]-'0')*4;

    ans=ans+(s[6]-'0')*5;

    ans=ans+(s[7]-'0')*6;

    ans=ans+(s[8]-'0')*7;

    ans=ans+(s[9]-'0')*8;

    ans=ans+(s[10]-'0')*9;

    ans%=11;

    char p;

    if(ans==10)

    p='X';

    else

    p=ans+'0';

    if(s[12]==p)

    cout

  • 0
    @ 2009-11-03 21:01:18

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

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

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

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

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

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

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

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

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

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

  • 0
    @ 2009-11-03 16:47:54

    var

    a:string;

    ch,b:char;

    c,n,m,o,v,i,dd:integer;

    begin

    read(a);

    n:=length(a)-2;

    o:=0;

    v:=0;

    for i:=1 to n do

    if a[i]'-' then

    begin

    v:=v+1;

    b:=a[i];

    m:=ord(b)-ord('0');

    m:=m*v;

    o:=m+o;

    end;

    c:=o mod 11;

    ch:=a[n+2];

    if c=10 then

    begin

    if ch='x' then write('right')

    else for i:=1 to n+1 do

    write(a[i]);

    write('x');

    end;

    if c10 then

    begin

    ch:=a[n+2];

    dd:=ord(ch)-ord('0');

    if dd=c then write('right')else

    for i:=1 to n+1 do

    write(a[i]);

    write(c);

    end;

    end.

  • 0
    @ 2009-11-01 20:32:34

    program isbn;

    var

    a:array[1..10] of char;

    s:string;

    ch:char;

    n,t,i:integer;

    begin

    n:=0;

    s:='';

    for i:=1 to 12 do

    begin

    read(ch);

    if ch in ['0'..'9'] then

    begin

    inc(n);

    a[n]:=ch;

    t:=t+(ord(ch)-48)*n;

    end;

    s:=s+ch;

    end;

    read(a[10]);

    t:=t mod 11;

    if t=10 then ch:='X'

    else ch:=chr(48+t);

    if ch=a[10] then s:='Right'

    else s:=s+ch;

    writeln(s);

    end.

  • 0
    @ 2009-11-01 15:19:26

    编译通过...

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

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

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

    ├ 测试数据 04:答案错误...程序输出比正确答案长

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

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

    ├ 测试数据 07:答案错误...程序输出比正确答案长

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

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

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

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

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

    //vijos1484

    #include

    #include

    using namespace std;

    //main

    int main()

    {

    //定义

    char a[13]={};

    int i,s=0;

    //begin

    cin>>a;

    s+=(a[0]-'0')*1;

    s+=(a[2]-'0')*2;

    s+=(a[3]-'0')*3;

    s+=(a[4]-'0')*4;

    s+=(a[6]-'0')*5;

    s+=(a[7]-'0')*6;

    s+=(a[8]-'0')*7;

    s+=(a[9]-'0')*8;

    s+=(a[10]-'0')*9;

    s=s%11;

    if((s+'0')==a[12])

    cout

  • 0
    @ 2009-11-01 02:45:05

    编译通过...

    ├ 测试数据 01:答案错误...程序输出比正确答案长

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

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

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

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

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

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

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

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

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

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

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

  • 0
    @ 2009-10-31 16:07:08

    program dfd;

    var

    a,d,e:string;

    b:array[1..10]of integer;

    c:array[1..10]of string;

    i,j,k,l,o,p:integer;

    begin

    readln(a);

    o:=0;

    delete(a,2,1);

    delete(a,5,1);

    delete(a,10,1);

    for i:=1 to 10 do

    begin

    c[i]:=copy(a,i,1);

    val(c[i],b[i]);

    o:=o+b[i]*i

    end;

    o:=o-b[10]*10;

    p:=o mod 11;

    if p=10

    then d:='X';

    if (b[10]=p)or(c[10]=d)

    then writeln('Right')

    else begin

    insert('-',a,2);

    insert('-',a,6);

    insert('-',a,12);

    delete(a,13,1);

    if p=10

    then writeln(a,'X')

    else writeln(a,p);

    end;

    end.

  • 0
    @ 2009-10-31 06:05:09

    program thurs;

    var

    s:string;

    b,k:integer;

    function sbm(n:string):integer;

    var i,j:integer;m:longint;

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

    begin

    j:=0;m:=0;

    for i:=1 to 12 do

    if n[i] in ['0'..'9']

    then begin

    j:=j+1;

    a[j]:=(ord(n[i])-ord('0'));

    end;

    for i:=1 to 9 do

    m:=m+a[i]*i;

    sbm:=m mod 11;

    end;

    begin

    read(s);

    k:=sbm(s);

    if ((k

  • 0
    @ 2009-10-27 21:23:24

    program isb;

    type o=0..13;

    var input,output:text;

    isbn:array[1..9] of o;

    p:string;

    i,j,a,b:o;

    y,x:char;

    begin

    assign(input,'isbn.in'); reset(input);

    assign(output,'isbn,out'); rewrite(output);

    read(input,p); a:=1;

    for i:=1 to 11 do if p[i]'-' then

    begin

    isbn[a]:=str(p[i]);

    a:=a+1;

    end;

    if p[13]'X' then b:=str(p[13])

    else b:=10;

    j:=0; for i:=1 to 9 do j:=j+isbn[i]*i; j:=j mod 11;

    if b=j then write(output,'Right');

    if bj then begin

    for i:=1 to 12 write(output,p[12]);

    if b10 then write(output,b)

    else write('X');

    end;

    close(input);

    close(output);

    end.

  • 0
    @ 2009-10-27 10:21:52

    注意细节,那个'X'要特殊判断

  • 0
    @ 2009-10-22 22:42:58

    program ISBN;

    var s,ans,ch:string;

    i,j,an:longint;

    begin

    read(s);

    j:=1;

    i:=1;

    while j='0') and (s[i]

  • 0
    @ 2009-10-21 18:12:30

    program xxx;

    var i,j,t,m,n,k:longint;

    b:boolean;

    c:array[1..13] of char;

    a:array[1..13] of longint;

    begin

    for i:=1 to 13 do read(c[i]);

    for i:=1 to 13 do a[i]:=100;

    for j:=1 to 13 do if c[j]'-' then if c[j]='X'then a[j]:=10 else val(c[j],a[j]);

    m:=0;

    t:=1;

    for i:=1 to 11 do

    if a[i]100 then begin

    m:=m+t*a[i];

    inc(t);

    end;

    k:=m mod 11;

    if k=a[13] then write('Right') else begin

    for i:=1 to 12 do

    write(c[i]);

    if k=10 then write('X') else write(chr(k+48));

    end;

    end.

  • 0
    @ 2009-10-19 18:00:02

    var

    s:string;

    len,tot,i:longint;

    begin

    readln(s);

    len:=length(s);

    tot:=(ord(s[1])-48)*1+(ord(s[3])-48)*2+(ord(s[4])-48)*3+(ord(s[5])-48)*4+(ord(s[7])-48)*5+(ord(s[8])-48)*6+(ord(s[9])-48)*7+(ord(s[10])-48)*8+(ord(s[11])-48)*9;

    if (s[13]='X') and (tot mod 11=10) then

    begin

    writeln('Right');

    halt;

    end

    else if (tot mod 11=(ord(s[13])-48)) then

    begin

    writeln('Right');

    halt;

    end;

    for i:=1 to 12 do

    write(s[i]);

    if (tot mod 11=10) then writeln('X')

    else writeln(tot mod 11);

    end.

  • 0
    @ 2009-10-18 20:10:09

    #include

    using namespace std;

    int main(){

    int a,b,c,d,e,f,g,h,i;

    char j,rj;

    scanf("%1d-%1d%1d%1d-%1d%1d%1d%1d%1d-%1c",&a,&b,&c,&d,&e,&f,&g,&h,&i,&j);

    rj=(a*1+b*2+c*3+d*4+e*5+f*6+g*7+h*8+i*9)%11;

    if(rj==10)

    rj='X';

    else

    rj+='0';

    if(rj==j)

    cout

  • 0
    @ 2009-10-15 08:38:01

    别的不说...大家一定要审好题...晕死我了

    program p1484;

    var

    sum, k, p : longint;

    s : string;

    begin

    k := 0;

    sum := 0;

    readln(s);

    for i:=1 to length(s)-2 do

    if s[i]'-' then

    begin

    inc(k);

    p:=ord(s[i])-ord('0');

    sum := sum +p*k;

    end;

    sum := sum mod 11;

    if s[length(s)]='X' then

    p:=10

    else

    p:=ord(s[length(s)]) - ord('0');

    if sum=p then writeln('Right')

    else

    begin

    for i := 1 to length(s)-1 do

    write(s[i]);

    if sum=10 then writeln('X')

    else writeln(sum);

    end;

    end.

  • 0
    @ 2009-10-08 10:30:13

    var

    a,n:string;

    b,c,d,e,f,g,h,i,j,k,l:integer;

    m:char;

    begin

    readln(a);

    b:=ord(a[1])-48;

    c:=ord(a[3])-48;

    d:=ord(a[4])-48;

    e:=ord(a[5])-48;

    f:=ord(a[7])-48;

    g:=ord(a[8])-48;

    h:=ord(a[9])-48;

    i:=ord(a[10])-48;

    j:=ord(a[11])-48;

    k:=(b*1+c*2+d*3+e*4+f*5+g*6+h*7+i*8+j*9) mod 11;

    case k of

    1:m:='1';

    2:m:='2';

    3:m:='3';

    4:m:='4';

    5:m:='5';

    6:m:='6';

    7:m:='7';

    8:m:='8';

    9:m:='9';

    10:m:='X';

    end;

    if a[13]=m then write('Right') else

    begin

    for k:=1 to 12 do

    write(a[k]);

    write(m);

    end;

    end.

信息

ID
1484
难度
5
分类
字符串 点击显示
标签
递交数
14462
已通过
4955
通过率
34%
被复制
33
上传者