Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

y

Posted by 201030720525 at 2011-07-28 15:29:33 on Problem 1840
#include "iostream"
#include "cstdio"
#include "cstring"
using namespace std;
int a[5];
const int Min = -50, Max = 50;
char hash[25000010];
int main() {
    memset(hash, 0, sizeof(hash));
    for(int i = 0; i < 5; i++) cin >> a[i];
    for(int i = Min; i <= Max; i++) {
        if(i == 0) continue;
        for(int j = Min; j <= Max; j++) {
            if(j == 0) continue;
            for(int k = Min; k <= Max; k++) {
                if(k == 0) continue;
                int tmp = i * i * i * a[0] + j * j * j * a[1] + k * k * k * a[2];
                if(tmp > 12500000 || tmp < -12500000)
                     continue;
                hash[tmp + 12500000]++;
            }
        }
    }
    int ans = 0;
    for(int i = Min; i <= Max; i++) {
        if(i == 0) continue;
        for(int j = Min; j <= Max; j++) {
            if(j == 0) continue;
            int tmp = -(i * i * i * a[3] + j * j * j * a[4]);
            ans += hash[tmp+12500000];
        }
    }
    cout << ans << endl;
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator