Hangzhou Electric 2534--score (regular problem)

Source: Internet
Author: User
Tags gcd


Time limit:5000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 1042 Accepted Submission (s): 448

Problem description As we all know, PFZ is "outstanding students in electricity", at the award ceremony of outstanding students, LXH and PFZ did not listen to what is said on the stage, but in the following discussion of the evening's American football match, Lxh predicted that the New York Giants will get 11 points tonight, PFZ immediately said it was impossible. Because usually the American football match scored only 3 points and 7 in two forms, no matter how to score can not get 11 points. After thinking for a while, Lxh found that in fact, more than 11 points are can be obtained, so 11 is the largest can not get the score. Now the question is, if the score of the game is only X and Y, then what is the maximum number of points that cannot be obtained?

Input includes multiple sets of input
Enter 2 integers per group x, Y (2<=x, y<=10^8), x=y=0 for end of input

Output for each set of inputs, outputs a row, if there is a maximum not available score, output this score, otherwise the output inf

Sample INPUT3 72 20 0

Sample Output11inf

Sourcethe 6th UESTC Programming Contest

Recommendlcy | We have carefully selected several similar problems for you:1573 1060 1018 2535 3244 n days without knocking over the title, my fault. Brain Tease TM fast out of Xiang. First of all, look for a two times the feeling. Find the law, see the puzzle. Summarize it. int doesn't know why he can't live.
#include <cstdio>#include<cstring>#include<iostream>using namespaceStd;__int64 gcd (__int64 x, __int64 y) {returnx%y==0? Y:GCD (y, x%y); }intMain () {__int64 x, y;  while(~SCANF ("%i64d%i64d", &x, &y), x+y) {printf (gcd (x, y)==1?"%i64d\n":"inf\n", x*y-x-y); }    return 0;}

Hangzhou Electric 2534--score (regular problem)

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.