COCI '07 Contest 5 #2 Pascal

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 32M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Little Frane is already in tenth grade, but is still struggling with Pascal in computer class. For homework, his teacher wrote the following program into his notebook, and he needs to determine the output, given the integer N.

readln(N);
counter := 0;
for i := N-1 downto 1 do begin
 counter := counter + 1;
 if N mod i = 0 then break;
end;
writeln(counter);

Write a program which solves Frane's problem.

Input Specification

The first line of input contains the integer N (1 \le N \le 10^9
).

Output Specification

Output the result on a single line.

Sample Input 1

1

Sample Output 1

0

Sample Input 2

10

Sample Output 2

5

Sample Input 3

27

Sample Output 3

18

Comments

There are no comments at the moment.