{
exist = true;
break;
}
}
if (!exist)
{
temppre.Add(preres1);
}
}
}
private bool isMax(int[] a, int[] m, int r)
{
bool flag = true;
for (int i = 1; i <= r; ++i)
{
if (a[i] < m[i])
{
flag = false;
break;
}
}
return flag;
}
private bool resEqual(ArrayList l1, ArrayList l2, int len)
{
bool res = true;
for (int i = 0; i < len; ++i)
{
if (((Robber)l1[i]).coins != ((Robber)l2[i]).coins)
{
res = false;
break;
}
return res;
}
public partial class Robber
{
public Robber(int i, int c)
{
id = i;
coins = c;
}
public int id;
public int coins;
}
public partial class RobberIdCom : IComparer
{
public int Compare(object x, object y)
{
return ((Robber)y).id - ((Robber)x).id;
}
}
public partial class RobberCoinsCom : IComparer
{
public int Compare(object x, object y)
{
if (((Robber)x).coins == ((Robber)y).coins)
{
return ((Robber)y).id - ((Robber)x).id;
}
return ((Robber)x).coins - ((Robber)y).coins;
}
}
}
引用或转载请注明原文,谢谢!