Bestcoder Round 70

Source: Internet
Author: User
Tags cmath

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

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.