아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Elite Eating

시간 제한1초메모리 제한1024 MB

요약
1부터 1000까지의 브랜드 중에서 N개를 골라 제곱의 합이 S보다 작은 부분집합의 개수를 센다.
난이도

보통10점 중 7점

유형
동적 계획법, 조합론, 수학
정답자
아직 제출이 없습니다

문제

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 ≤ N ≤ 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 ≤ S < = 10,100).

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

입력

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

출력

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

힌트

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.

예제1

  1. 예제 1

    입력
    3 30
    
    예상 출력
    4