about summary refs log tree commit diff
path: root/daily/306easy/panroman.pas
blob: 5721f623151dd1e1a41d168716e3d4211bb5f063 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
uses strutils;

var
  i: int16;

function ivxlcdm(s: string): boolean;
  var
    a: array['C'..'X'] of int8;
    c: char;

  begin
    for c in 'IVXLCDM' do
      a[c] := 0;
    for c in s do
      inc(a[c]);
    for c in 'IVXLCDM' do
      if a[c] <> 1 then
        exit(false);
    ivxlcdm := true
  end;

begin
  for i := 1000 to 2000 do
    if ivxlcdm(inttoroman(i)) then
      writeln(i)
end.