| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
顶起PASCAL!var
n,i,j,len,he,k,m:longint;
a:string;
begin
readln(n);
for i:=1 to n do
begin
he:=0;
readln(a);
writeln('Scenario #',i,':');
len:=length(a);
for j:=len downto 1 do
if a[j]<>'?' then begin
if (len-j+1)mod 3=1 then k:=9
else if (len-j+1)mod 3=2 then k:=3
else k:=7;
he:=he+(ord(a[j])-48)*k;
end;
m:=pos('?',a);
if (len-m+1)mod 3=1 then k:=9
else if (len-m+1)mod 3=2 then k:=3
else k:=7;
for j:=0 to 9 do
begin
he:=he+j*k;
if he mod 10=0 then begin a[m]:=chr(j+48); break; end else he:=he-j*k;
end;
writeln(a);
writeln;
end;
end.
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator