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