Rokua P1372 is also the graduating season I Label:none

Source: Internet
Author: User
Tags greatest common divisor

Topic background

"Ding Bell Bell Bell", with the final section of the entrance examination bell ringing, three years of youthful time immediately solidified in the moment. Graduation of the joy how the enemy that parting, longing for the future still do not forget the song. More than 1000 days and nights of laughter and tears, all condensed in the graduation party, I believe, this must be the most memorable moment in life!

Title Description

In order to make the graduation party better, the teacher wants to pick out the most tacit understanding of the biggest k personal participation in the graduation party rehearsal. But how to pick it? The teacher lists the class numbers 1,2,......,n, and believes that the degree of personal understanding of K is their greatest common divisor (this is not superstition Oh ~). This is difficult for him, please help!

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

Input/output format

Input format:

Two spaces separated by a positive integer n and K. (n>=k>=1)

Output format:

An integer that is the maximum tacit value.

Input and Output Sample input example # #:
4 2
Sample # # of output:
2
Description

"Source of the topic"

LZN Original

"Data Range"

For 20% of data, k<=2,n<=1000

For another 30% of the data, k<=10,n<=100

For 100% of data, K<=1e9,n<=1e9 (God Ben School, a large number of people)

1 #include <cstdio>2int main () {int n,k;scanf ("%d%d  ", &n,&k);p rintf ("%d\n", n/k); return 0;}

(This length ...)

Reprint:

Can directly assume that the maximum common factor p is selected

Then the chosen one can be expressed as 1*p,2*p. K*p (of course this means the smallest)

Then must meet K*p<=n

So p<=n/k

Rokua P1372 is also the graduating season I Label:none

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.