Bestcoder Round #70 1001 Jam ' s math problem

Source: Internet
Author: User

Ideas: A,b,c are 10^9, direct multiplication will explode int, directly sentenced sqrt (B^2-4AC) is not equal to 0 of the integer can be


#include <cstdio>
#include <queue>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
# Include <string>
#include <set>
#include <ctime>
#include <cmath>
# Include <cctype>
using namespace std;
#define MAXN 100000
#define LL long long
int cas=1,t;
int main ()
{
	//freopen ("in", "R", stdin);
	scanf ("%d", &t);
	while (t--)
	{
		LL a,b,c;
		Double ans = 0;
		scanf ("%i64d%i64d%i64d", &a,&b,&c);
        LL Delta = b*b-4 * A*C;
		LL k = 0;
		bool OK = 1;
		while ((k+1) * (k+1) <=delta)
			++k;
		OK = delta>=0 && k*k==delta;
		Puts (ok? ") YES ":" NO ");
	}
	printf ("Time=%.3lf", (double) clock ()/clocks_per_sec);
	return 0;
}






Problem description

Jam A math problem I want to ask you, he just learned to factorization for example, x^2+6x+5= (x+1) (x+5) x 2 +6x+5= (x+1) (x+5)
is like a ax^2+bx+cax 2 +bx+c = pqx^2+ (qk+mp ) x+km= (px+k) (qx+m) PQX 2 + (QK+MP) x+km= (px+k) (qx+m)
But he was stupid, he would only do p,q,m,kp,q,m,k as a positive integer question
ask you to help him, asked can decompose
Enter a description
The first line of TT, which represents the T (1 \leq t \leq) t (1≤t≤100) group data.
Next the TT Group data:
one row per group of data, a three integer a,b,ca,b,c, a set of data rows (1 \leq a,b,c \leq 100000000) (1≤a,b,c≤100000000)
Output description
For each set of data, output "YES" or "NO".
Input sample
2
1 6 5
1 6 4
Output sample
YES
NO
Hint
The first set of data can be divided into (x+1) (x+5) =x^2+6*x+5 (x+1) (x+5) =x 2 +6∗x+5


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.