Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
1AC PASCALvar a:array[1..10000] of longint; x,i,n,m,sum,s,j:integer; procedure fac(n:integer); var j:integer; begin for i:=1 to n do begin for j:=1 to x do a[j]:=a[j]*i; for j:=1 to x do if a[j]>9 then begin a[j+1]:=a[j+1]+a[j] div 10; a[j]:=a[j] mod 10; end; while a[x+1]<>0 do begin inc(x); if a[x]>9 then begin a[x+1]:=a[x+1]+a[x] div 10; a[x]:=a[x] mod 10; end; end; if a[x+1]<>0 then inc(x); end; end; begin readln(j); for s:=1 to j do begin fillchar(a,sizeof(a),0); sum:=0; read(n,m); a[1]:=1; x:=1; fac(n); for i:=x downto 1 do if a[i]=m then inc(sum); writeln(sum); end; end. 顶起PASCAL!!!! Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator