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

USACO代码直接代入……^_^ 0MS(附代码)

Posted by zyx980506 at 2010-04-11 12:43:16 on Problem 1166 and last updated at 2010-04-11 12:47:17
const
    change:array[1..9,1..9]of integer=
                 ((3,3,3,3,3,2,3,2,0),
                 (2,3,2,3,2,3,1,0,1),
                 (3,3,3,2,3,3,0,2,3),
                 (2,3,1,3,2,0,2,3,1),
                 (2,3,2,3,1,3,2,3,2),
                 (1,3,2,0,2,3,1,3,2),
                 (3,2,0,3,3,2,3,3,3),
                 (1,0,1,3,2,3,2,3,2),
                 (0,2,3,2,3,3,3,3,3));
var  temp,ans:array[1..9] of integer;
     i,j,k:integer;
     s:string;
begin
  for i:=1 to 9 do begin
    read(temp[i]);
  end;
  close(input);
  fillchar(ans,sizeof(ans),0);
  for i:=1 to 9 do
    for k:=1 to 9 do inc(ans[k],change[i,k]*(4-temp[i]));
  for i:=1 to 9 do ans[i]:=ans[i]mod 4;
  s:='';
  for i:=1 to 9 do
    for j:=1 to ans[i] do s:=s+chr(i+48)+' ';
  delete(s,length(s),1);
  writeln(s);
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