QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 256 MB Points totaux : 100

#22682. Elite Eating

Statistiques

FJ has uniquely branded 1,000 cows, each with an integer in the range (1..1,000).

FJ has also created an elite eating program where exactly $N$ ($1 \le N \le 250$) cows with specific brands get to enter the barn first. The restriction on this elite group of cows is that the sum of the squares of the cows' brands must be strictly less than a given integer $S$ ($1 \le S \le 10{,}100$).

Determine the number of different groups of cows that can be selected for the elite eating program.

Input

  • Line 1: Two space-separated integers, $N$ and $S$

Output

  • Line 1: A single integer that is the number of different possible groups that can line up for elite eating.

Examples

Input 1

3 30

Output 1

4

Output Details

The sequences of length 3 with sum of squares < 30 are:

1 2 3
1 2 4
2 3 4
1 3 4

The sequence of brands 1 2 5 is not valid since $1 + 4 + 25 = 30$ and is not strictly less than 30.

Problem credits: Bulgarian Winter 2002; via Nikolay Valtchanov, 2003

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.