| 
 | 
back to boardWhy my Programme Crash? using System; namespace acm1005 {     class Program     {         public static int[] w=new int[21];         public static bool[] f;         public static int DP_StonePile(int n)         {             int total=0;             for(int i=1;i<=n;i++) total+=w[i];             int avg=total/2;             f=new bool[total];             f[0]=true;             int max=0;             for(int j=1;j<=n;j++)                 for(int i=avg-w[j];i>=0;i--)                 {                     if(f[i]==true)                     {                         f[i+w[j]]=true;                         if(i+w[j]>max) max=i+w[j];                     }                 }             return total-2*max;         }         public static void Main(string[] args)         {             int n=Int32.Parse(Console.ReadLine());             for(int i=1;i<=n;i++)                 w[i]=Int32.Parse(Console.ReadLine());             Console.WriteLine(DP_StonePile(n));             //Console.Write("Press any key to continue . . . ");             //Console.ReadKey(true);         }     } } Re: Why my Programme Crash? Mine too @.@ Re: Why my Programme Crash? Posted by  llf 24 Jan 2012 13:08 OH I got Crash on test #4 ,too`~~~ Mine too @.@  |  
  | 
|