【题意】
求C(q,p)/C(r,s)的值,保留五位小数
【输入】
多组数据,每组数据一行为q、p、r、s
【输出】
对于每组数据,输出一个数表示C(q,p)/C(r,s)的值
将因数分解后约分再从大到小乘除即可
program poj2613; var p,q,r,s,i,j,k:longint; ans:extended; count:array [0..10001] of longint; begin while not seekeof do begin fillchar(count,sizeof(count),0); read(p,q,r,s); for i:=2 to p do inc(count[i]); for i:=2 to q do dec(count[i]); for i:=2 to p-q do dec(count[i]); for i:=2 to r do dec(count[i]); for i:=2 to s do inc(count[i]); for i:=2 to r-s do inc(count[i]); ans:=1; for i:=10000 downto 2 do if count[i]>0 then begin for j:=1 to count[i] do ans:=ans*i; end else if count[i]<0 then begin for j:=1 to -count[i] do ans:=ans/i; end; writeln(ans:0:5); end; end.