Defeat, can not laugh at others, or they will be like others as unlucky
1001:http://acm.hdu.edu.cn/showproblem.php?pid=5615
Ax^2+bx+c can be split into (px+k) (qx+m) Form
Good way, the original was hack.
1#include <cstdio>2#include <iostream>3#include <cmath>4#include <cstring>5#include <queue>6#include <vector>7#include <algorithm>8 9 #defineRep (i,a,n) for (int i = A;i < n;i++)Ten #definePer (i,n,a) for (int i = N-1;i >=a;i--) One #definePB Push_back A #defineVI vector<int> - #defineQI queue<int> - #defineLOG2 (n) log10 (n)/log10 (2) the #defineEPS 1e-8 - -typedefLong Longll; - + using namespacestd; - + A intMain () { at intT; -scanf"%d",&T); - while(t--){ - ll A,b,c,d; -scanf"%i64d%i64d%i64d",&a,&b,&c); -D = b*b-4*a*C; in if(d = = (ll) sqrt (d) *(LL) sqrt (d)) { -Puts"YES"); to } + Else{ -Puts"NO"); the } * } $ return 0;Panax Notoginseng}
View Code
1002:http://acm.hdu.edu.cn/showproblem.php?pid=5616
01 Backpack, remember to go back and forth two times
In addition, for ease of use operator or 0|0 = 0, 0|1 = 1, 1|1 = 1
1#include <cstdio>2#include <iostream>3#include <cmath>4#include <cstring>5#include <queue>6#include <vector>7#include <algorithm>8 9 #defineRep (i,a,n) for (int i = A;i < n;i++)Ten #definePer (i,n,a) for (int i = N-1;i >=a;i--) One #definePB Push_back A #defineVI vector<int> - #defineQI queue<int> - #defineLOG2 (n) log10 (n)/log10 (2) the #defineEPS 1e-8 - -typedefLong Longll; - + using namespacestd; - + Const intN = -+5; A Const intMAXN = -+5; at intn,sum; - intA[n] = {}; - intDP[MAXN] = {}; - - intMain () { - intT; inscanf"%d",&T); - while(t--){ tosum =0; +scanf"%d",&n); -Rep (I,0, N) { thescanf"%d",&a[i]); *Sum + =A[i]; $ } Panax NotoginsengMemset (DP,0,sizeof(DP)); -dp[0] =1; theRep (I,0, N) { +Per (j,sum+1, A[i]) { ADP[J] |= dp[j-A[i]]; the } + } -Rep (I,0, N) { $Rep (J,0, sum-a[i]+1){ $DP[J] |= dp[j+A[i]]; - } - } the intZ; -scanf"%d",&z);Wuyi while(z--){ the ints; -scanf"%d",&s); Wu if(Dp[s]) { -printf"yes\n"); About } $ Else{ -printf"no\n"); - } - } A } + return 0; the}
View Code
Flag, I'm going to make another 1003.
Bestcoder Round