这题有什么规律 Description Could you tell me the coefficient of x^k in (1+x)^n is odd or even?Input The first line of the input contains a integer T,indicate the number of test cases.For each case,there are two integers n,k (0 楼下能再讲

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/25 12:23:11
这题有什么规律 Description Could you tell me the coefficient of x^k in (1+x)^n is odd or even?Input The first line of the input contains a integer T,indicate the number of test cases.For each case,there are two integers n,k (0 楼下能再讲
x]OPǿʹ!i]#f7RaYpI-ـᦈEѽa`šn@2ʯfd.lwKy9F훯UJv{]oXsJVWTj>DCԬ̯| IUU b!^87)y0gA0q0DEqYsjTҬZ&ĚmE>,[;0*jo3n& pcS1?? T4e%2}{ᣞys U6B7V_An?] GĿ^

这题有什么规律 Description Could you tell me the coefficient of x^k in (1+x)^n is odd or even?Input The first line of the input contains a integer T,indicate the number of test cases.For each case,there are two integers n,k (0 楼下能再讲
这题有什么规律
Description
Could you tell me the coefficient of x^k in (1+x)^n is odd or even?
Input
The first line of the input contains a integer T,indicate the number of test cases.
For each case,there are two integers n,k (0
楼下能再讲讲吗?

这题有什么规律 Description Could you tell me the coefficient of x^k in (1+x)^n is odd or even?Input The first line of the input contains a integer T,indicate the number of test cases.For each case,there are two integers n,k (0 楼下能再讲
这个是牛顿二项式定理的内容.
楼上说的不错.
其实你可以直接转化为排列组合就行了:
3 1,表示3个人里选1个人,判断选人的方法数是奇数还是偶数.
4 2,表示4个人里选2个人,判断选人的方法数是奇数还是偶数.
C(3,1)=3,奇数.C(4,2)=6,偶数.
其实就是让你求C(n,k)%2是==1,还是==0?
由于k和n很大,你就要用下面这种公式:
(A/B)%K=(A%(B*K))/B;
(A*B)%K=((A%K)*(B%K))%K;

牛顿二项式定理可以递归实现,判断奇偶性直接除2取余