• 2022-07-23
    设计一个程序,计算组合数C(m,r)=m!/(r!×(m-r)!),其中m、r为正整数,且m>r。分别求出C(4,2) 、C(4,6)、C(8,7)的组合数。求阶乘和组合数须用函数来完成。
  • #include [iostream] using namespace std; float f(int n){ if(n[0){ cout<<"n应为正数!\n"; exit(1); } float s; if(n==1||n==0) return 1; else s=n*f(n-1); return s; } float c(int m,int r){ if(mm>>r; cout<<"c("<

    内容

    • 0

      IA-32中指令“PUSH EBP”的功能是( )。 A: R[ESP]← R[ESP]-4, M[R[ESP]]← R[EBP] B: R[ESP]← R[ESP]+4, M[R[ESP]]← R[EBP] C: M[R[ESP]]← R[EBP], R[ESP]← R[ESP]-4 D: M[R[ESP]]← R[EBP], R[ESP]← R[ESP]+4

    • 1

      IA-32中指令“movb%al,0x1(,%ecx,4)”的功能是()。 A: M[R[ecx]*4+1]←R[al] B: R[al]←M[R[ecx]*4+1] C: M[R[ecx]*4]←R[al] D: R[al]←M[R[ecx]*4]

    • 2

      IA-32中指令“popl %ebp”的功能是( )。? R[ebp]←M[R[esp]],R[esp]←R[esp]+4|R[esp]←R[esp]-4,R[ebp]←M[R[esp]]|;R[ebp]←M[R[esp]],R[esp]←R[esp]-4|R[esp]←R[esp]+4,R[ebp]←M[R[esp]]

    • 3

      IA-32中指令“movl 8(%edx, %esi, 4), %edx”的功能是( )。 A: M[R[edx]+R[esi]*4+8]←R[edx] B: M[R[esi]+R[edx]*4+8]←R[edx] C: R[edx]←M[R[edx]+R[esi]*4+8] D: R[edx]←M[R[esi]+R[edx]*4+8]

    • 4

      设A为m×n阶矩阵,B为n×m阶矩阵,且m>n,令r(AB)=r,则( ). A: r>m B: r=m C: rD.r≥m