fork download
  1. uses strutils;
  2.  
  3. var
  4. i: int16;
  5.  
  6. function ivxlcdm(s: string): boolean;
  7. var
  8. a: array['C'..'X'] of int8;
  9. c: char;
  10.  
  11. begin
  12. for c in 'IVXLCDM' do
  13. a[c] := 0;
  14. for c in s do
  15. inc(a[c]);
  16. for c in 'IVXLCDM' do
  17. if a[c] <> 1 then
  18. exit(false);
  19. ivxlcdm := true
  20. end;
  21.  
  22. begin
  23. for i := 1000 to 2000 do
  24. if ivxlcdm(inttoroman(i)) then
  25. writeln(i)
  26. end.
Success #stdin #stdout 0s 600KB
stdin
Standard input is empty
stdout
1444
1446
1464
1466
1644
1646
1664
1666