Problem2339--NOIP2014提高组F.  解方程

2339: NOIP2014提高组F.  解方程

Time Limit: 1.000 Sec  Memory Limit: 128 MB
Submit: 0  Solved: 1
[Submit] [Status] [Web Board] [Creator:][下载测试数据]

Description

已知多项式方程:

a0+a1x+a2x2+…+anxn=0

求这个方程在[1,m]内的整数解(nm均为正整数)。


Input

输入共 n+2行。

第一行包含 2个整数  nm,每两个整数之间用一个空格隔开。

接下来的 n+1行每行包含一个整数,依次为a0,a1,a2,…,an





【数据说明】

对于30%的数据,0  < n 2|ai| 100an0m 100

对于50%的数据,0  < n 100|ai| 10100an0m 100

对于70%的数据,0  < n 100|ai| 1010000an0m 10000

对于100%的数据,0  < n 100|ai| 1010000an0m 1000000



Output

第一行输出方程在[1, m]内的整数解的个数。

接下来每行一个整数,按照从小到大的顺序依次输出方程在[1, m]内的一个整数解。


Sample Input

2 10
1
-2
1

Sample Output

1
1

HINT

【输入输出样例1

equation.in

equation.out

2 10

1

-2

1

1

1

 

【输入输出样例2

road.in

road.out

2 10

2

-3

1

 

2

1

2

 

 

【输入输出样例3

road.in

road.out

2 10

1

3

2

 

0

 


Source/Category


[Submit] [Status]