COCI 2007/2008, Contest #5
Task PASCAL
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
The first line of input contains the integer N (1 ≤ N ≤ 109).
Output
Output the result on a single line.
Examples
Input1 Output0 |
Input10 Output5 |
Input27 Output18 |
All Submissions
Best Solutions
Point Value: 5
Time Limit: 1.00s
Memory Limit: 32M
Added: Jan 29, 2009
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)
I think I understand, but what about the rest?
Here are equivalents in C++ and Python.