The number of walnuts in the fourth annual Blue Bridge Cup Javac Group

Source: Internet
Author: User

/* (Start of program header comment)

* Copyright and version Declaration section of the program

* Copyright (c) 2016, Guangzhou Science and Technology Trade Vocational College, Department of Information Engineering students

* All rights reserved.

* File name: Blue Bridge Cup title

* Author: Pengjunhau

* Completion Date: April 01, 2016

* Version number: 001

* Description part of task and solution method

* Description of the problem:

Xiao Zhang is a software project manager and he leads 3 development teams. The schedule is tight and it's working overtime today. To inspire morale, Xiao Zhang intends to give
Each group sends a sack of walnuts (according to rumors can be brain). His requirements are:

1. The number of walnuts in each group must be the same
2. Walnuts must be evenly divided within each group (not broken, of course)
3. Try to provide the minimum quantity to meet the conditions (save Revolution)

* Input Description:

The program reads from the standard input:
A b C
A,b,c are positive integers that indicate the number of people working overtime for each group, separated by a space (a,b,c<30)

* Program output:

Program output:
A positive integer that indicates the number of walnuts per bag.

For example:
User input:
2 4 5

Program output:
20

Again for example:
User input:
3 1 1

Program output:
3

* End of comment on the program head

*/

On the code:

Import Java.util.Scanner;

public class Main {

public static void Main (string[] args) {
Scanner sc = new Scanner (system.in);
int a = Sc.nextint ();
int b = Sc.nextint ();
int c = Sc.nextint ();

for (int i = 1; i < 2700; i++) {
if (i%a==0 && i%b==0 && i%c==0) {
System.out.println (i);
Break
}
}
}

}

The number of walnuts in the fourth annual Blue Bridge Cup Javac Group

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.