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:谁能告诉我输入2 1 3 是怎么赢的吗?具体步骤.......

Posted by nofree at 2005-11-12 20:53:37 on Problem 1740
In Reply To:谁能告诉我输入2 1 3 是怎么赢的吗?具体步骤....... Posted by:tuhongguo at 2004-08-04 15:34:41
2 1 3
first :2 1 3--> 2 2 (第三堆丢2个移1个到第二堆)
second:2 2->必赢之道也(对方去几个我去另一堆的几个)
code:
program A_New_Stone_Game
const
   inf='ANSG.in';
   ouf='ANSG.out';
var
   a    :array[1..10000] of word;
   n,ans:word;
   f    :text; 
procedure init;
   begin
      assign(f,inf);
      reset(f);
          readln(f,n);   
          for n:=1 to n do readln(f,a[n]);   
      close(f)    
   end;
procedure out;
   begin
      assign(f,ouf);
      rewrite(f);
         writeln(f,ans); 
         writeln(f,0,0);  
      close(f);  
   end;
procedure work;
   var m:longint;
   begin 
      for n:=1 to n do inc(m,a[n]);
      ans:=ord(odd(n) or (m mod 2)=0);  
   end;
begin 
   init;
   work;      
   out;
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