📄 preface.pas
字号:
{
ID:maigoak1
PROG:preface
}
program preface;
var
fin,fout:text;
i,v,x,l,c,d,m:longint;
n,t:integer;
begin
i:=0;v:=0;x:=0;l:=0;c:=0;d:=0;m:=0;
assign(fin,'preface.in');
reset(fin);
readln(fin,n);
close(fin);
t:=n div 10;
i:=i+14*t;
v:=v+5*t;
x:=x+t;
case n mod 10 of
1: inc(i);
2: i:=i+3;
3: i:=i+6;
4:begin i:=i+7; inc(v); end;
5:begin i:=i+7; v:=v+2; end;
6:begin i:=i+8; v:=v+3; end;
7:begin i:=i+10;v:=v+4; end;
8:begin i:=i+13;v:=v+5; end;
9:begin i:=i+14;v:=v+5;inc(x);end;
end;
t:=n div 100*10;
x:=x+14*t;
l:=l+5*t;
c:=c+t;
t:=n mod 10+1;
case n div 10 mod 10 of
1: x:=x+t;
2: x:=x+10+2*t;
3: x:=x+30+3*t;
4:begin x:=x+60+t; l:=l+t; end;
5:begin x:=x+70; l:=l+10+t; end;
6:begin x:=x+70+t; l:=l+20+t; end;
7:begin x:=x+80+2*t; l:=l+30+t; end;
8:begin x:=x+100+3*t;l:=l+40+t; end;
9:begin x:=x+130+t; l:=l+50; c:=c+t;end;
end;
t:=n div 1000*100;
c:=c+14*t;
d:=d+5*t;
m:=m+t;
t:=n mod 100+1;
case n div 100 mod 10 of
1: c:=c+t;
2: c:=c+100+2*t;
3: c:=c+300+3*t;
4:begin c:=c+600+t; d:=d+t; end;
5:begin c:=c+700; d:=d+100+t; end;
6:begin c:=c+700+t; d:=d+200+t; end;
7:begin c:=c+800+2*t; d:=d+300+t; end;
8:begin c:=c+1000+3*t;d:=d+400+t; end;
9:begin c:=c+1300+t; d:=d+500; m:=m+t;end;
end;
t:=n mod 1000+1;
case n div 1000 of
1:m:=m+t;
2:m:=m+1000+2*t;
3:m:=m+3000+3*t;
end;
assign(fout,'preface.out');
rewrite(fout);
if i>0 then writeln(fout,'I ',i);
if v>0 then writeln(fout,'V ',v);
if x>0 then writeln(fout,'X ',x);
if l>0 then writeln(fout,'L ',l);
if c>0 then writeln(fout,'C ',c);
if d>0 then writeln(fout,'D ',d);
if m>0 then writeln(fout,'M ',m);
close(fout);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -