luogu#P1372. 又是毕业季I

又是毕业季I

Background

"Ding-ling-ling-ling." With the ringing of the final bell of the Gaokao, three years of youth are frozen in this moment. The joy of graduation cannot outweigh the sorrow of parting; while looking forward to the future, we still do not forget the songs of the past. Over 10001000 days and nights of laughter and tears are condensed into the graduation party. We believe this must be one of the most unforgettable moments in a lifetime.

Problem Description

To make the graduation party better, the teacher wants to select kk students with the highest compatibility to participate in the rehearsal. But how to choose? The teacher lists all student numbers 1,2,,n1, 2, \ldots, n and believes that the compatibility level of kk students is their greatest common divisor (this is not superstition~). This is difficult for him, so please help!

PS: The greatest common divisor of a single number is the number itself.

Input Format

Two space-separated positive integers nn and kk.

Output Format

A single integer: the maximum compatibility value.

4 2

2

Hint

For 20%20\% of the testdata, k2k \le 2, n103n \le 10^3.

For another 30%30\% of the testdata, k10k \le 10, n100n \le 100.

For 100%100\% of the testdata, k109k \le 10^9, n109n \le 10^9, nk1n \ge k \ge 1 (a "Shenben" school, many students).

Translated by ChatGPT 5