QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22682. 選抜された牛の食事

Statistics

FJ は 1,000 頭の牛にそれぞれ異なる焼き印を付けました。焼き印は $1..1,000$ の範囲の整数です。

FJ は、特定の焼き印を持つちょうど $N$($1 \le N \le 250$)頭の牛が先に牛舎へ入れる特別な食事制度も作りました。この選抜された牛の組には、焼き印の数の二乗和が、与えられた整数 $S$($1 \le S \le 10{,}100$)より厳密に小さくなければならないという条件があります。

この特別な食事制度に選べる牛の組が何通りあるか求めてください。

入力

  • 1 行目:空白区切りの 2 つの整数 $N$ と $S$。

出力

  • 1 行目:特別な食事のために並べる異なる牛の組の数を表す 1 つの整数。

入出力例

入力 1

3 30

出力 1

4

注記

長さが 3 で二乗和が $< 30$ である列は次のとおりです。

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

焼き印の列 1 2 5 は、$1 + 4 + 25 = 30$ であり 30 より厳密に小さくないため、有効ではありません。

問題出典:Bulgarian Winter 2002、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.