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

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

Quite the cheater!

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

요약
평균이 정확히 주어진 값이고 분산도 정확히 주어진 값이 되도록, 절댓값 10^9 이하의 정수 10개 이상 1000개 이하를 만들어야 한다.
난이도

보통10점 중 7점

유형
수학, 그리디, 정수론, 구현
정답자
아직 제출이 없습니다

문제

Your physics lab report is due tomorrow. However, you had no time to do the required experiments, as you spent all your time practicing for the IPSC. Therefore you decided to write a fake report quickly. Here is how to get a good grade for your lab report:

  • It has to contain a lot of measurements.
  • You already know the correct value you were supposed to measure. The mean of all “measured” values in your report has to be equal to that value.
  • The values must look sufficiently random to avoid suspicion that you made them all up. (Yeah, right.) More formally, they must have a sufficient variance.

You are given two integers: the desired mean μ and the desired variance v.

Pick a number of measurements n and the values of those measurements a1,…,an such that the mean of those values is exactly μ and their variance is (easy subproblem: at least v / hard subproblem: exactly v). Formally, your values must satisfy the following conditions:

  • 10 ≤ n ≤ 1000

  • Each ai is an integer between −109 and 109, inclusive.

  • The value μ is exactly the mean: μ = (a1 + ⋯ + an)∕n.

  • The variance of your values is computed as follows: (1∕n) ⋅((a1 − μ)2 + ⋯ + (an − μ)2).

    (If you are a statistics buff, note that we are not using the unbiased sample variance formula (the one with 1∕(n−1) instead of 1∕n), as in our case the mean is known a priori. If the previous sentence makes no sense, just ignore it and use the formula in the problem statement.)

입력

The first line of the input file contains an integer t specifying the number of test cases. Each test case is preceded by a blank line.

Each test case contains a single line with two integers: μ and v.

You may assume that t ≤ 100, |μ|≤ 106, and 0 ≤ v ≤ 109.

출력

For each test case, output two lines. The first line should contain the number of values n, the second line a space-separated list of values a1,…,an. Any valid solution will be accepted.

힌트

This sequence of 11 values has mean exactly 47 and variance exactly 2080.

예제1

  1. 예제 1

    입력
    1
    
    47 2080
    
    예상 출력
    11
    34 -7 102 117 16 8 0 130 36 34 47