Integer solution (Hdu 2092

Source: Internet
Author: User

Integer solution

Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 25460 Accepted Submission (s): 8911


Problem description There are two integers, they add up equal to an integer, multiply and equal to another integer, whether they are true or false, that is, this integer does not exist, it is a bit doubt, you can quickly answer? Seems to be programmed only.
For example:
x + y = 9,x * y = 15? No such integer x and y are found
1+4=5,1*4=4, so, add up equals 5, multiply up equals 4 of two integers are 1 and 4
7+ (-8) =-1,7* (-8) =-56, so, add up equals-1, multiply equals-56 of two integers are 7 and 8

Input data is a paired integer n,m ( -10000<n,m<10000), which represents the integer and the product respectively, and if both are 0, the input ends.

Output requires only a "Yes" or "no" for each N and M, either explicitly or without the integer.

Sample Input9 155 41-560 0 Sample Outputnoyesyes Authorqianneng source Meet the new semester-super easy version super easy version
1#include <iostream>2#include <cstdio>3#include <cstring>4#include <cmath>5 6 using namespacestd;7 8 #defineN 519 #defineINF 0x3f3f3f3fTen  One intMain () A { -     intN, M; -  the      while(SCANF ("%d%d", &n, &m), n+m) -     { -         //int flag = 0; -  +         Doublex =1.0* (N+sqrt (n*n-4*M))/2; -         Doubley =1.0* (N-sqrt (n*n-4*M))/2; +  A         if(x = = (int) x && y = = (int) y) atprintf"yes\n"); -         Else -printf"no\n"); -     } -     return 0; -}

Study hard and live seriously. Think hard and study hard.

Integer solution (Hdu 2092

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.