WA+

P1055 [NOIP2008 普及组] ISBN 号码

代码呢?
by Xxzxx @ 2018-07-17 08:38:37


@[北洋张学良](/space/show?uid=57823)
by Xxzxx @ 2018-07-17 08:38:40


@[_WA自动机_](/space/show?uid=82363) #include<stdio.h> #include<string.h> int main(){ char as[1000],bs[1000]; gets(as); int n=strlen(as); int i,j,sum=0; sum=(as[0]-'0')*1+(as[2]-'0')*2+(as[3]-'0')*3+(as[4]-'0')*4+(as[6]-'0')*5+(as[7]-'0')*6+(as[8]-'0')*7+(as[9]-'0')*8+(as[10]-'0')*9; char m; if(sum%11==10)m='X'; else m=(sum%11)+'0'; if(m==as[n-1])printf("Right"); else {as[n-1]=m;puts(as);} return 0; }
by 红色OI再临 @ 2018-07-17 08:40:54


``` #include<stdio.h> #include<string.h> int main(){ char as[1000],bs[1000]; gets(as); int n=strlen(as); int i,j,sum=0; sum=(as[0]-'0')*1+(as[2]-'0')*2+(as[3]-'0')*3+(as[4]-'0')*4+(as[6]-'0')*5+(as[7]-'0')*6+(as[8]-'0')*7+(as[9]-'0')*8+(as[10]-'0')*9; char m; if(sum%11==10)m='X'; else m=(sum%11)+'0'; if(m==as[n-1])printf("Right"); else {as[n-1]=m;puts(as);} return 0; } ```
by Xxzxx @ 2018-07-17 08:41:46


其实我不会,(逃
by Xxzxx @ 2018-07-17 08:42:43


@[_WA自动机_](/space/show?uid=82363) 手动滑稽
by 红色OI再临 @ 2018-07-17 08:43:34


这年头怎么还有人用gets
by _ConveX @ 2018-07-17 09:03:12


把gets(as)改成fgets(1000,as,stdin)试试?
by GPTTest @ 2018-07-17 09:25:20


``` #include<stdio.h> #include<string.h> char as[1000],bs[1000]; int main(){ scanf("%s",as); int n=strlen(as); int i,j,sum=0; sum=(as[0]-'0')*1+(as[2]-'0')*2+(as[3]-'0')*3+(as[4]-'0')*4+(as[6]-'0')*5+(as[7]-'0')*6+(as[8]-'0')*7+(as[9]-'0')*8+(as[10]-'0')*9; char m; if(sum%11==10)m='X'; else m=(sum%11)+'0'; if(m==as[n-1]) printf("Right"); else {as[n-1]=m;printf("%s",as);} return 0; } ```
by jzzcjb @ 2018-07-17 09:27:51


@[北洋张学良](/space/show?uid=57823)
by jzzcjb @ 2018-07-17 09:31:37


| 下一页