Nanyang ACM34-Han Xin dianbing

Source: Internet
Author: User

/*
Question 34 --- Han Xin dianbing
Time Limit: 3000 MS | memory limit: 65535 KB
Difficulty: 1
Description
According to legend, Han believes that his talents never count the number of people in his army directly. As long as the soldiers change the formation in a row of three, five, and seven, each time he only takes a glance at the tail of the team, he will know the total number of people. Enter three non-negative integers a, B, and c to indicate the number of people in each formation (a <3, B <5, c <7 ), minimum value of the total output number (or no solution is reported ). The total number is not less than 10, but not more than 100.
Input
Enter three non-negative integers a, B, and c, indicating the number of people in each formation (a <3, B <5, c <7 ). For example, input: 2 4 5
Output
Minimum value of the total output number (or No solution is reported, that is, No answer is output ). Instance, output: 89
Sample Input
2 1 6 sample output
41
*/

# Include

Using namespace std;

Int main ()
{
Int a, B, c;
Int I, n = 0;

Cin> a> B> c;

For (I = 1; I <16; ++ I)
{
N = I * 7 + c;
If (n <10)
{
Continue;
}
If (n> 100)
{
Break;
}
If (n % 3 = a & n % 5 = B)
{
Cout < Return 0;
}
}
Cout <"No answer" <

Return 0;
}

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.