HDU 1496 Equations

Source: Internet
Author: User

As if it was a hash, direct enumeration will definitely time out.

The AB records must be divided into two groups.

Then find the corresponding CD

 

There are still many questions

For example, the end of * 16

And amazing STL

 

# Include <stdio. h> # include <string. h> # include <math. h> # include <iostream> # include <algorithm> # include <queue> # include <stack> # define MEM (a, B) memset (A, B, sizeof (A) # define ll _ int64 # define maxn 1000 # define INF 0x7ffffff # define lson L, M, RT <1 # define rson m + 1, R, RT <1 | 1 using namespace STD; int num1 [2, 12000]; int main () {int A, B, C, D, I, J; while (scanf ("% d", & A, & B, & C, & D )! = EOF) {int coun = 0; for (I = 1; I <= 100; I ++) {for (j = 1; j <= 100; j ++) {num1 [coun ++] = A * I * I + B * j;} Sort (num1, num1 + coun); int CNT = 0; for (I = 1; I <= 100; I ++) {for (j = 1; j <= 100; j ++) {int T; int temp = C * I * I + D * j; If (t = (upper_bound (num1, num1 + coun,-Temp)-lower_bound (num1, num1 + coun, -Temp) CNT + = T ;}} printf ("% d \ n", CNT * 16);} return 0 ;}

 

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.