andmej / acm

My solutions for problems from the UVa Online Judge (Valladolid).

This URL has Read+Write access

acm / 10127 - Ones / robadoDelForo.dpr
100755 31 lines (27 sloc) 0.479 kb
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
27
28
29
30
31
program robadoDelForo;
 
{$APPTYPE CONSOLE}
 
uses
  SysUtils;
 
var
  a, l, k, no : integer;
begin
  reset(input, 'input.txt');
  reset(output, 'output.txt');
  while not EOF do
    begin
    readLn(a);
    k := 1;
    no := 1;
    while true do
      begin
        l := k mod a;
        if (l = 0) then
          begin
            writeLn(no);
            break;
          end;
        k := l * 10 + 1;
        no := no + 1;
      end;
    end;
end.