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

进位制思想~47ms

Posted by wyc4662 at 2011-07-27 19:02:15 on Problem 1401 and last updated at 2011-07-27 19:10:02
const a:array[1..12] of longint=(5,25,125,625,3125,15625,78125,390625,1953125,9765625,48828125,244140625);
      c:array[1..12] of longint=(1,6,31,156,781,3906,19531,97656,488281,2441406,12207031,61035156);
var i,j,n,m,l,t,k:longint;
begin
  readln(m);
  for l:=1 to m do begin
    t:=0;
    readln(n);
    for i:=12 downto 1 do
      while n>=a[i] do begin t:=t+c[i]; n:=n-a[i]; end;
    writeln(t);
  end;
end.

求大牛们的16ms做法

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