Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

1AC PASCAL

Posted by aiouniya at 2012-08-23 15:19:56 on Problem 3331
var 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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator