We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #251: Cardano Triplets

Project Euler #251: Cardano Triplets

Problem
Submissions
Leaderboard
Discussions
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #251: Cardano Triplets
Exit Full Screen View
  • Problem
  • Submissions
  • Leaderboard
  • Discussions

This problem is a programming version of Problem 251 from projecteuler.net

A triplet of positive integers is called a Cardano Triplet if it satisfies the condition:

For example, is a Cardano Triplet.

There exist Cardano Triplets for which .

Find how many Cardano Triplets exist such that .

Input Format

The first line of each test file contains a single integer , which is the number of queries. lines follow, each containing the corresponding .

Constraints

OR

OR

Output Format

Print exactly lines with the answer to the corresponding query on each one.

Sample Input 0

2
8
1000

Sample Output 0

1
149

Explanation 0

is the only triplet with the sum .

Sample Input 1

2
999999069
999999550

Sample Output 1

172332336
172332416
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature