Пример #1
0
int find1(int a[][4], int i, int j, int flag) {
		if(i>=4 || j>=4)
				return 0;
		if((a[i][j] == 0) && (flag == 1))
				return 0;
		if((a[i][j] == 0) && (flag == 0))
				return max(find1(a,i+1,j,0),find1(a,i,j+1,0));
		if(a[i][j] == 1)
				return 1 + max(find1(a,i+1,j,1),find1(a,i,j+1,1));
}
Пример #2
0
static const struct optioninfo *find(const char **optp,
				     const char *prefix,
				     comparer_type *comparer) {
  const struct optioninfo *oip;
  const char *opt;

  opt= *optp;
  oip= find1(optp,perquery_options,comparer);
  if (oip) return oip;
  oip= find1(optp,global_options,comparer);
  if (!oip) usageerr("unknown option %s%s",prefix,opt);
  if (ads) usageerr("global option %s%s specified after query domain(s)",prefix,opt);
  return oip;
}
Пример #3
0
static void  mkorientedloops(hlpcsptr* alll)
{int        i, j; 
 hlpcsptr    tmp; 

   tmp = *alll; 
   while (tmp != NULL) 
   { 
      tmp->sgn = 1; 
      tmp = tmp->next; 
   } 
   tmp = *alll; 
   while (tmp != NULL) 
   { 
      i = 1; j = 1; 
      while (find1(&i,&j,tmp)) insertorient(i,j,tmp); 
      tmp = tmp->next; 
   } 
   tmp = *alll; 
   while (tmp != NULL) 
   { 
      for (i = 0; i < vcs_stat.sizet; i++) 
      for (j = 0; j < vcs_stat.valence[i]; j++) 
      if (tmp->hlpcs[i][j] != 0) tmp->hlpcs[i][j] --  ;               
      tmp = tmp->next; 
   } 

   tmp = (hlpcsptr) m_alloc(sizeof(struct hlpcsrec)); 
   /*    addition  of origin graph  */ 
   for (i = 1; i <= vcs_stat.sizet; i++) 
      for (j = 1; j <= vcs_stat.valence[i-1]; j++) tmp->hlpcs[i-1][j-1] = 0; 
   tmp->sgn = 1; 
   tmp->next = *alll; 
   *alll = tmp;
          
}   /*  MkOrientedLoops  */ 
Пример #4
0
void RandGame1()
{
	int i, j;
	for (i = 0; i < N; i++)
		for (j = 0; j <= N-5; j++)
			if (find1(matrix, i, j))
			{
				print1(i, j);
			}
}
int main()
{
	int arr[101],n,x,max,i,p,q;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&arr[i]);
	qsort(arr,n,sizeof(int),cmp);
	scanf("%d%d",&p,&q);
	max=0;
	for(i=0;i<n-1;i++)
	{
		x=find(arr[i],arr[i+1],p,q);
		if(max<x)
			max=x;
	}
	x=find1(arr[0],p,q);
	y=find1(arr[n-1],p,q);
	printf("%d\n",max);
	
	return 0;
}
Пример #6
0
int main(int argc, char* argv[])
{
    int array[4][4] =
    {
        1, 2, 8, 9,
        2, 4, 9, 12,
        4, 7, 10, 13,
        6, 8, 11, 15,
    };

    assert(!find1(NULL, 4, 4, 6));
    assert(find1(&array[0][0], 4, 4, 6));
    assert(find1(&array[0][0], 4, 4, 7));
    assert(find1(&array[0][0], 4, 4, 11));
    assert(!find1(&array[0][0], 4, 4, 5));
    assert(!find1(&array[0][0], 4, 4, 3));

    assert(!find2(NULL, 4, 4, 6));
    assert(find2(&array[0][0], 4, 4, 6));
    assert(find2(&array[0][0], 4, 4, 7));
    assert(find2(&array[0][0], 4, 4, 11));
    assert(!find2(&array[0][0], 4, 4, 5));
    assert(!find2(&array[0][0], 4, 4, 3));
    return 0;
}
Пример #7
0
/*
static void find0(FILE *out,PCStr(top))
*/
static void find0(FILE *out,PCStr(Root),PCStr(top))
{	DA dab;
	FileStat st;

	dab.d_top = 1;
	dab.d_out = out;
	dab.d_Rlen = Root?strlen(Root):0;
	dab.d_Root = Root;
	dab.d_cwd = "";
	dab.d_dev = 0;
	dab.d_ino = 0;
	dab.d_blocks = 0;
	dab.d_nch = 0;
	dab.d_nrm = 0;
	dab.d_lev = DIRLEV;
	find1(top,&dab);
}
Пример #8
0
void Ffind(CL_FORM *base, int nargs)
{
	BOOL supl_flags[6];
	static CL_FORM * keylist[] =
	{
		SYMBOL(Slisp, 284),	/* FROM-END */
		SYMBOL(Slisp, 272),	/* TEST */
		SYMBOL(Slisp, 553),	/* TEST-NOT */
		SYMBOL(Slisp, 229),	/* START */
		SYMBOL(Slisp, 230),	/* END */
		SYMBOL(Slisp, 207),	/* KEY */
	};
	keysort(ARG(2), nargs - 2, 6, keylist, supl_flags, FALSE);
	if(NOT(supl_flags[0]))
	{
		LOAD_NIL(ARG(2));
	}
	if(NOT(supl_flags[1]))
	{
		LOAD_NIL(ARG(3));
	}
	if(NOT(supl_flags[2]))
	{
		LOAD_NIL(ARG(4));
	}
	if(NOT(supl_flags[3]))
	{
		LOAD_SMALLFIXNUM(0, ARG(5));
	}
	if(NOT(supl_flags[4]))
	{
		COPY(SYMVAL(Slisp, 0), ARG(6));	/* MOST-POSITIVE-FIXNUM */
	}
	if(NOT(supl_flags[5]))
	{
		LOAD_NIL(ARG(7));
	}
	find1(ARG(0));
}
Пример #9
0
int main()
{
    find1();
    find2();
}
Пример #10
0
 inline const typename boost::disable_if<boost::is_same<first_type, second_type>, first_type>::type&
 operator[] (const second_type& key) const
 { return find1(key); }
Пример #11
0
void main() {
		int a[4][4] = {{0,0,1,1},{1,1,1,0},{1,0,1,0},{0,1,0,1}};
		printf("%d\n",find1(a, 0, 0, 0));
}
Пример #12
0
int main(int argc, char *argv[])
{
    bool running = false;


        TFullName res;
        TFindProcess find;
        while(find.Next(res) == KErrNone)
        {
            RProcess ph;
            ph.Open(res);

            if(ph.SecureId() == 0x2002B30D)

            if (ph.ExitType() == EExitPending)
            {
                running = true;
                break;
            }

            ph.Close();
        }



    if (running == false)
    {

        QProcess *myProcess = new QProcess;
        myProcess->start("whatsapp.exe");
    }
    else {

        QApplication app(argc, argv);
        CAknConfirmationNote* run = new (ELeave) CAknConfirmationNote;
        QT_TRAP_THROWING(run->ExecuteLD(_L("Closed WhatsApp")));
        TFullName res1;
        TFindProcess find1(_L("*[2002B306]*"));

        while(find1.Next(res1) == KErrNone)
        {
            RProcess ph1;
            ph1.Open(find1);
            ph1.Kill(KErrNone);
            ph1.Close();
        }

        TFullName res2;
        TFindProcess find2(_L("*[2002B310]*"));

        while(find2.Next(res2) == KErrNone)
        {
            RProcess ph2;
            ph2.Open(find2);
            ph2.Kill(KErrNone);
            ph2.Close();
        }

        TFullName res3;
        TFindProcess find3(_L("*[2002B30D]*"));

        while(find3.Next(res3) == KErrNone)
        {
            RProcess ph3;
            ph3.Open(find3);
            ph3.Kill(KErrNone);
            ph3.Close();
        }
        QTest::qWait(1500);
    }
    return 1;
}