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

大牛请进,小弟已WA数次,望各位指点迷津

Posted by yanghuan at 2006-10-12 23:37:52 on Problem 1306
Program pku1306;
Var
  m, n, n0, m0: Longint;
  sum: Int64;
Begin
  Readln(n, m);
  While (n + m <> 0) Do Begin
    Sum := 1;
    m0 := 1;
    For n0:=n downto n - m + 1 Do Begin
      Sum := Sum * n0;
      While (Sum Mod m0 = 0) And (m0 <= m) Do Begin
        Sum := Sum Div m0;
        Inc(m0);
      End;
    End;
    Writeln(n, ' things taken ', m, ' at a time is ', Sum, ' exactly.') 
    Readln(n, m);
  End;
End.
       

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