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:请大家帮忙看下,这"WRONG ANSWER"

Posted by luosuocumt16 at 2016-05-10 20:15:40 on Problem 3187
In Reply To:请大家帮忙看下,这"WRONG ANSWER" Posted by:mountain_fly at 2010-10-19 22:11:32
> 
> pascal的暴搜
> 
> 
> program LL;
> type arr=array[1..10]of integer;
> var
>   n,s,i:integer;
>   b,z,t:arr;
> procedure work(x,L:longint;b:arr);
> var
>   i,j,bj:integer;
> begin
>   b[L]:=x;
>   if L=n then
>   begin
>     z:=b;
>     for j:=1 to n-1 do
>     for i:=1 to n-j+1 do
>     b[i]:=b[i]+b[i+1];
>     if b[1]=s then
>     begin
>       bj:=0;
>       for i:=1 to n do
>       if t[i]<z[i] then
>       begin
>         bj:=1;
>         break;
>       end
>       else if z[i]<t[i] then
>            begin
>              bj:=2;
>              break;
>            end;
>       if bj=1 then
>       else if bj=2 then t:=z;
>     end;
>     exit;
>   end;
>   for i:=1 to 9 do
>   begin
>     bj:=0;
>     for j:=1 to L do
>     if i=b[j] then
>     begin
>       bj:=1;
>       break;
>     end;
>     if bj=0 then
>     work(i,L+1,b);
>   end;
> end;
> begin
>   readln(n,s);
>   fillchar(t,sizeof(t),9);
>   for i:=1 to 9 do
>   begin
>     fillchar(b,sizeof(b),0);
>     work(i,1,b);
>   end;
>   for i:=1 to n do write(t[i],' ');
> 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