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

Re:我这个Pascal 17行0MS是不是更精髓呢

Posted by lydliyudong at 2011-07-20 14:50:37 on Problem 1068
In Reply To:30L精髓16ms在线算法 Posted by:kill_myself at 2011-07-14 21:47:25
var
 p,w:array[0..20]of longint;
 t,n,i,j:longint;
begin
 readln(t);
 repeat
  dec(t);
  readln(n);
  for i:=1 to n do read(p[i]);
  for i:=1 to n do
   for j:=i-1 downto 0 do
    if p[i]-p[j]>=i-j then
     begin w[i]:=i-j; break; end;
  for i:=1 to n-1 do write(w[i],' ');
  writeln(w[n]);
 until t=0;
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