题解

279 条题解

  • 0
    @ 2008-11-29 15:22:25

    无奈~~~看少了10~~~

    改后~~~

    AC

    for i:=1 to 11 do begin

    if s[i]'-' then

    begin

    inc(t);

    n:=n+(ord(s[i])-48)*t;

    end;

    end;

    n:=n mod 11;

    if n=10 then ss:='X' else ss:=chr(n+48);

    if ss=s[13] then write('Right') else begin

    for i:=1 to 12 do write(s[i]);write(ss);

    end;

  • 0
    @ 2008-11-29 15:02:10

    无视此垃圾水题

    无视NOIP的出题能力

  • 0
    @ 2008-11-29 14:36:55

    太粗心了...

    第一次忘了 余数是10要输出X,50分..

    第二次忘了 如果余数是10并且输入文件中最后一为是X要输出Right

    第三次才AC.....

    我想如果是考试的话 我也不一定拿多少分呢.....

    郁闷

    通过率让我拉下一点.....

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

    考试时没注意如果mod 11=10就要输出‘X’,少了50分啊~~~~

  • 0
    @ 2008-11-29 11:13:58

    program isbn;

    var

    a:ansistring;

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

    i,j:integer;

    x:longint;

    begin

    readln(a);x:=0;

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

    b[3]:=ord(a[4])-48;b[4]:=ord(a[5])-48;

    b[5]:=ord(a[7])-48;b[6]:=ord(a[8])-48;

    b[7]:=ord(a[9])-48;b[8]:=ord(a[10])-48;

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

    if a[13]'X' then b[10]:=ord(a[13])-48

    else b[10]:=10;

    for i:=1 to 9 do

    x:=x+i*b[i];

    x:=x mod 11;

    if x=b[10] then write('Right')

    else

    if x=10 then begin for i:=1 to 12 do write(a[i]);write('X');end

    else begin for i:=1 to 12 do write(a[i]);write(x);end;

    end.

  • 0
    @ 2008-11-29 10:18:14

    囧……今年280,错在这道题上了!哎……

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    var

    s:string;

    a:array[0..20]of byte;

    i,j,ans:integer;

    begin

    read(s);

    j:=0;

    for i:=1 to 13 do

    if s[i]'-' then

    begin

    inc(j);

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

    then a[j]:=ord(s[i])-48

    else a[j]:=10;

    end;

    ans:=0;

    for i:=1 to j-1 do

    ans:=(ans+a[i]*i) mod 11;

    if a[j]=ans

    then write('Right')

    else begin

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

    if ans=10

    then write('X')

    else write(ans);

    end;

    end.

    Flag    Accepted

    题号   P1484

    类型(?)   字符串处理

    通过   55人

    提交   110次

    通过率   50%

    难度   1

    提交 讨论 题解

  • 0
    @ 2008-11-29 00:34:15

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    我 有罪……

    交 了 3次!!!

    通过率 被我 给 刷 下来 了……

    最后 一位 为 10 应该 输出 大写 X 啊!!!!!!!!

    55555555555555…………………………………………

    vijos 评测机 还 一直 给 我 3个点 “超时,无输出” ……

    怒!!

  • 0
    @ 2008-11-28 22:52:03

    大牛说说这个程序为什么只能过8个点啊

    program project1;

    var i,sum,x,J:longint;

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

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

    begin

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

    for i:=1 to 13 do

    begin

    if (ord(a[i])=48) then b[i]:=0;

    if (ord(a[i])=49) then b[i]:=1;

    if (ord(a[i])=50) then b[i]:=2;

    if (ord(a[i])=51) then b[i]:=3;

    if (ord(a[i])=52) then b[i]:=4;

    if (ord(a[i])=53) then b[i]:=5;

    if (ord(a[i])=54) then b[i]:=6;

    if (ord(a[i])=55) then b[i]:=7;

    if (ord(a[i])=56) then b[i]:=8;

    if (ord(a[i])=57) then b[i]:=9;

    if (ord(a[i])=95) then b[i]:=-1;

    end;

    sum:=((b[1])+(b[3]*2)+(b[4]*3)+(b[5]*4)+(b[7]*5)+(b[8]*6)+(b[9]*7)+(b[10]*8)+(b[11]*9));

    x:=sum mod 11;

    if b[13]=x then writeln('Right')

    else if x=10 then

    write(a[1],'-',a[3],a[4],a[5],'-',a[7],a[8],a[9],a[10],a[11],'-','X')

    else write(a[1],'-',a[3],a[4],a[5],'-',a[7],a[8],a[9],a[10],a[11],'-',x);

    end.

  • 0
    @ 2008-11-28 22:43:18

    NOIP08年的水题。。。

    直接把比赛程序Copy上来就Ac了。

    注意判断‘X’和输入输出的'-'~~

  • 0
    @ 2008-11-28 22:22:34

    搞成个NOIP08第一题似的,好水啊~~~~

  • 0
    @ 2008-11-28 21:46:23

    Var

    str:string;

    s,i,sn:integer;

    bool:boolean;

    Begin

    readln(str);

    s:=0;

    for i:=1 to 11 do

    if str[i]'-' then

    begin

    inc(s);

    sn:=(ord(str[i])-48)*s+sn;

    end;

    sn:=sn mod 11;

    if (sn

  • 0
    @ 2008-11-29 13:24:37

    var

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

    s:string;

    i,j,n,code:longint;

    begin

    readln(s);

    val(s[1],a[1],code);

    for i:=3 to 5 do val(s[i],a,code);

    for i:=7 to 11 do val(s[i],a,code);

    if s[13]'X' then val(s[13],a[10],code)

    else a[10]:=10;

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

    n:=n mod 11;

    if n=a[10] then writeln('Right')

    else if n=10 then writeln(a[1],'-',a[2],a[3],a[4],'-',a[5],a[6],a[7],a[8],a[9],'-X')

    else writeln(a[1],'-',a[2],a[3],a[4],'-',a[5],a[6],a[7],a[8],a[9],'-',n);

    readln

    end.

    白痴过法

    如果没AC可能是没注意最后读入的数是X的情况

  • 0
    @ 2008-11-28 21:40:27

    我怎么么那么牛呢。。。。4编才过。。。。

  • 0
    @ 2008-11-28 20:59:46

    点击这里查看所有通过记录

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

    此名单按照通过此题的时间顺序进行排序前100位

    子夜长河 xianweizhao liuzj9436 霓虹灯下的天启 tjc 0401DE0401 NASH2007 coolinging jayhaizeizai 

    庆祝第9个通过

  • 0
    @ 2008-11-28 21:35:33

    var a:array[1..10]of integer;

    var s:string;

    var i,n:integer;

    begin

    read(s);

    while length(s)>0 do

    begin

    if s[1]'-' then

    begin

    inc(i);

    val(s[1],a[i]);

    end;

    if s[1]='X' then a[i]:=10;

    s:=copy(s,2,length(s));

    end;

    for i:=1 to 9 do

    begin

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

    n:=n mod 11;

    end;

    if a[10]=n then write('Right')

    else

    begin

    write(a[1],'-');

    for i:=2 to 4 do

    write(a[i]);

    write('-');

    for i:=5 to 9 do

    write(a[i]);

    if n=10 then write('-','X')

    else

    write('-',n)

    end;

    end.

  • 0
    @ 2008-11-28 20:42:50

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    水题

  • -1
    @ 2018-01-21 14:34:39

    有点长的模拟
    #include<cstdio>
    #include<cstring>
    char a[20];
    int b[20],sum,m,n;
    int main()
    {
    scanf("%s",a); m=strlen(a);
    for(int i=0;i<m;i++)
    if(a[i]>='0' && a[i]<='9') b[i]=a[i]-48;
    sum=b[0]+b[2]*2+b[3]*3+b[4]*4+b[6]*5+b[7]*6+b[8]*7+b[9]*8+b[10]*9;
    n=sum%11;
    if(n==10) b[12]=a[12]-78;
    if(b[12]==n) { printf("Right"); return 0; }
    if(n==10) a[12]='X';
    else a[12]=n+'0';
    printf("%s",a);
    return 0;
    }

  • -1
    @ 2017-12-19 17:00:28

    //简单AC,刚才发成了修改前的代码
    #include <iostream>
    #include<string>
    using namespace std;
    int main()
    {
    string a;
    int add,n=1;
    cin>>a;
    int s=a.size()-1 ;
    for(int i=0;i<s;i++)
    {
    if(a[i]!='-') add+=(a[i]-'0')* n++;
    }
    if(add%11==(a[s]-'0')||( add%11==10 && a[s]=='X'))cout<<"Right"<<endl;
    else if(add%11==10)
    {
    a[s]='X';
    cout<<a<<endl;
    }
    else
    {
    a[s]=add%11+'0';
    cout<<a<<endl;
    }

    return 0;
    }

  • -1
    @ 2016-11-28 03:44:55
    #include <iostream>
    #include <cstdlib>
    #include <cstdio>
    #include <climits>  
    #include <cmath>
    #include <algorithm>
    #include <functional>
    #include <iterator>
    #include <cstring>
    #include <set>
    #include <vector>
    #include <queue>
    #include <list>
    #include <cctype>
    #include <string>
    
    using namespace std;
    
    
    
    int main()
    {
      string s;
      cin>>s;
    
      int tt=(s[0]-'0')*1+(s[2]-'0')*2+(s[3]-'0')*3+(s[4]-'0')*4+(s[6]-'0')*5+
             (s[7]-'0')*6+(s[8]-'0')*7+(s[9]-'0')*8+(s[10]-'0')*9;
    
      tt=tt%11;
    
      if(tt==s[12]-'0'){cout<<"Right";}
      else if(tt==10)
      {
        if(s[12]=='X'){cout<<"Right";}
        else{s[12]='X';cout<<s;}
      }
      else{s[12]=48+tt;cout<<s;}
    
      return 0;
    }
    

信息

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