1 条题解
-
0
C++ :
#include<cstdio> #include<iostream> #include<string> using namespace std; int main() { string s,s2;int total=0; cin>>s; s2=s; s2.erase(1,1); s2.erase(4,1); s2.erase(9,1); for(int i=0;i<=8;++i) total+=(s2[i]-48)*(i+1); total=total%11; if(s2[9]==total+48) printf("Right"); else { s[12]=total+48; cout<<s<<endl; } return 0; }
Pascal :
var a:array[1..9] of shortint; ch:char; s,i,x:integer; st:string; begin readln(st); a[1]:=ord(st[1])-48; for i:=2 to 4 do a[i]:=ord(st[i+1])-48; for i:=5 to 9 do a[i]:=ord(st[i+2])-48; ch:=st[13]; if ch='X' then x:=10 else x:=ord(ch)-48; s:=0; for i:=1 to 9 do s:=s+a[i]*i; s:=s mod 11; if s=x then writeln('Right') else begin write(a[1],'-',a[2],a[3],a[4],'-'); for i:=5 to 9 do write(a[i]); write('-'); if s=10 then writeln('X') else writeln(s); end; end.
- 1
信息
- ID
- 3213
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者