

Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
var x:array[1..100000] of integer;
s:string;
i:byte;
t:integer;
begin
readln(s);
for i:=1 to length(s) do
begin
if s[i]='I' then x[i]:=1;
if s[i]='V' then x[i]:=5;
if s[i]='X' then x[i]:=10;
if s[i]='L' then x[i]:=50;
if s[i]='C' then x[i]:=100;
if s[i]='D' then x[i]:=500;
if s[i]='M' then x[i]:=1000;
end;
for i:=1 to length(s) do
if x[i+1]<=x[i] then
t:=t+x[i]
else
t:=t-x[i];
write(t);
end.
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin