예제 #1
0
파일: check.cpp 프로젝트: hrnn/olymp
void answer (FILE * f)
{
 int i, j;
 char ch;
 memset (a, 0, sizeof (a));
 inbln (f, a);
 for (i = 0; i < k; i++)
 {
  if (fscanf (f, " %d", &u[i]) != 1)
   chkexit ("More numbers are required.", PE);
 }
 if (fscanf (f, " %c", &ch) != EOF)
  chkexit ("Extra info present.", PE);
 for (i = 0; i < k; i++)
 {
  if (u[i] < 1 || u[i] > n)
   chkexit ("Number not in range.", START); // WA
  if (i && u[i - 1] >= u[i])
   chkexit ("Duplicate numbers or sequence not sorted.", START); // WA
 }
 memset (d, 0, sizeof (d));
 d[0] = d[1] = 1;
 for (i = 0; i < k; i++)
 {
  j = gcd (d, u[i]);
  assert (!(u[i] % j));
  j = u[i] / j;
  multc (d, d, j);
 }
 if (!equ (a, d))
  chkexit ("LCM given does not match numbers.", START); // WA
}
int main()
{
    int flag,i;
    ji=0;
    while(cin>>tem)
    {
        if(tem == "XXXXXX")
            break;
        dic[ji]=tem;
        ji++;
    }
    qsort(dic,ji,sizeof(dic[0]),cmp);        

    while(cin>>tem)
    {
        if("XXXXXX" == tem)
            break;
        flag=0;
        for(i=0;i<ji;i++)
        {
            if(1 == equ(dic[i],tem))
            {
                flag=1;
                cout<<dic[i]<<endl;
            }
        }
        if(0 == flag)
            printf("NOT A VALID WORD\n");
        printf("******\n");
    }
    return 0;
}
예제 #3
0
파일: ct.c 프로젝트: EdKeith/core
static F1(jtfacit){A c;V*u,*v;
 RZ(c=coeff(w));
 if(AN(c))R tpoly(tymes(c,fact(AT(c)&XNUM+RAT?xco1(IX(IC(c))):IX(IC(c)))));
 v=VAV(w);
 if(CFORK==v->id)switch(ID(v->g)){
  case CDIV:
   if(CBANG==ID(v->h))R v->f; 
   break;
  case CSTAR:
   if(CFORK==ID(v->h)&&(u=VAV(v->h),CDIV==ID(u->g)&&CBANG==ID(u->h)))R folk(v->f,v->g,u->f);
   RZ(c=atop(ds(CDIV),ds(CBANG)));
   if(equ(c,v->f))R v->h;
   if(equ(c,v->h))R v->f;
 }
 R folk(ds(CBANG),ds(CSTAR),w);
}
예제 #4
0
파일: 2105.cpp 프로젝트: WayneTimer/ACM
int main()
{
  double k,l,s,w;
  double v2;
  while (scanf("%lf%lf%lf%lf",&k,&l,&s,&w)==4)
  {
    if (equ(k,0)) break;
    if (l>s || equ(l,s))
      v2=2.0*G*s;
    else
      v2=2.0*G*s-k*(s-l)*(s-l)/w;
    if (v2<-EPS) puts("Stuck in the air.");
    else if (v2<PV2 || equ(v2,PV2)) puts("James Bond survives.");
    else puts("Killed by the impact.");
  }
  return 0;
}
예제 #5
0
파일: oplib.cpp 프로젝트: anang0g0/kryptism
//リーディングタームで多項式を割る
oterm LTdiv(OP f,oterm t){
  oterm tt,s;

  tt=LT(f);
  if(tt.n<t.n){
    s.n=0;
    s.a=0;
  } else if(tt.n==t.n){
    s.n=0;
    s.a=equ(t.a,tt.a);
  }else if(tt.n>t.n){
    s.n=tt.n-t.n;
    s.a=equ(t.a,tt.a);
    printf("%u\n",s.a);
}

  return s;    
}
예제 #6
0
파일: devices.c 프로젝트: js4/ngaro
void video_circle(int xCenter, int yCenter, int radius)
{
  int x = 0, y = radius;
  setOthers(x, y, xCenter, yCenter);
  while (x < y)
  {
    x++;
    if (equ(x, y - (float) 1 / 2, radius) >= 0)
      y--;
    setOthers(x, y, xCenter, yCenter);
  }
}
예제 #7
0
파일: cp.c 프로젝트: mlochbaum/jsource
static DF1(jtpowseqlim){PROLOG(0039);A x,y,z,*zv;I i,n;
 RZ(w);
 RZ(z=exta(BOX,1L,1L,20L)); zv=AAV(z); *zv++=x=w;
 i=1; n=AN(z);
 while(1){
  if(n==i){RZ(z=ext(0,z)); zv=i+AAV(z); n=AN(z);}
  RZ(*zv++=x=df1(y=x,self));
  if(equ(x,y)){AN(z)=*AS(z)=i; break;}
  ++i;
 }
 z=ope(z);
 EPILOG(z);
}    /* f^:(<_) w */
예제 #8
0
CTEST(equation_suite, inv_arg_test)
{
	//Given
	const double a = 0;
	const double b = 0;
	const double c = 7.0;

	//When
	double x1 = 0, x2 = 0;
	const int rv = equ(a, b, c, &x1, &x2);

	//Then
	ASSERT_EQUAL(INV_ARG, rv);
}
예제 #9
0
CTEST(equation_suite, noroots_test)
{
	//Given
	const double a = 2.0;
	const double b = 4.0;
	const double c = 7.0;

	//When
	double x1 = 0, x2 = 0;
	const int rv = equ(a, b, c, &x1, &x2);

	//Then
	ASSERT_EQUAL(NOROOTS, rv);
}
예제 #10
0
int main( int hola, char** file_name)
{
  CvRect rect;
  rect.x=121;rect.y=110;rect.width=814;rect.height=223;
  erCerc cerc(135,293,25);
  erEqualP equ(0);
  erSmootP p1(BLUR,7),p2(MEDIAN,5);
  erCannyP cann(355,355);
  erAdThrP adp(THRESH_BINARY,AM_MEAN,49,119,255); //** < */
  erMacroDropAnalysis mda("hump");
  mda.defineParameters(rect,cerc,p1,p2,cann,adp,equ);
  mda.doIt("hump_1.bmp");
  return(0);
};
예제 #11
0
CTEST(equation_suite, oneroots2_test)
{
	//Given
	const double a = 1;
	const double b = 6;
	const double c = 9;

	//When
	double x1 = 0, x2 = 0;
	const int rv = equ(a, b, c, &x1, &x2);

	//Then
	const double expected_x1 = -3;

	ASSERT_DBL_NEAR(expected_x1, x1);
	ASSERT_EQUAL(ONEROOT, rv);
}
예제 #12
0
CTEST(equation_suite, tworoots_test)
{
	//Given
	const double a = 1.41;
	const double b = 70.24;
	const double c = 600.01;

	//When
	double x1 = 0, x2 = 0;
	const int rv = equ(a, b, c, &x1, &x2);

	//Then
	const double expected_x1 = -10.948617021;
	const double expected_x2 = -38.866985816;

	ASSERT_DBL_NEAR(expected_x1, x1);
	ASSERT_DBL_NEAR(expected_x2, x2);
	ASSERT_EQUAL(TWOROOTS, rv);
}
예제 #13
0
파일: cf.c 프로젝트: PlanetAPL/j-language
// Create the derived verb for a fork.  Insert in-placeable flags based on routine, and asgsafe based on fgh
A jtfolk(J jt,A f,A g,A h){A p,q,x,y;AF f1=jtfolk1,f2=jtfolk2;B b;C c,fi,gi,hi;I flag,j,m=-1;V*fv,*gv,*hv,*v;
 RZ(f&&g&&h);
 gv=VAV(g); gi=gv->id;
 hv=VAV(h); hi=hv->id;
 // Start flags with ASGSAFE (if g and h are safe), and with INPLACEOK to match the setting of f1,f2
 flag=(VINPLACEOK1|VINPLACEOK2)+((gv->flag&hv->flag)&VASGSAFE);  // We accumulate the flags for the derived verb.  Start with ASGSAFE if all descendants are.
 if(NOUN&AT(f)){  /* y {~ x i. ] */
  // Temporarily raise the usecount of the noun.  Because we are in the same tstack frame as the parser, the usecount will stay
  // raised until any inplace decision has been made regarding this derived verb, protecting the derived verb if the
  // assigned name is the same as a name appearing here.  If the derived verb is used in another sentence, it must first be
  // assigned to a name, which will protects values inside it.
  rat1s(f);  // This justifies keeping the result ASGSAFE
  f1=jtnvv1;
  if(LIT&AT(f)&&1==AR(f)&&gi==CTILDE&&CFROM==ID(gv->f)&&hi==CFORK){
   x=hv->f;
   if(LIT&AT(x)&&1==AR(x)&&CIOTA==ID(hv->g)&&CRIGHT==ID(hv->h)){f1=jtcharmapa;  flag &=~(VINPLACEOK1);}
  }
  R fdef(CFORK,VERB, f1,jtnvv2, f,g,h, flag, RMAX,RMAX,RMAX);
 }
 fv=VAV(f); fi=fv->id; if(fi!=CCAP)flag &= fv->flag|~VASGSAFE;  // remove ASGSAFE if f is unsafe
 switch(fi){
  case CCAP:                      f1=jtcork1; f2=jtcork2;  break; /* [: g h */
  case CTILDE: if(NAME&AT(fv->f)){f1=jtcorx1; f2=jtcorx2;}  break; /* name g h */
  case CSLASH: if(gi==CDIV&&hi==CPOUND&&CPLUS==ID(fv->f)){f1=jtmean; flag|=VIRS1; flag &=~(VINPLACEOK1);} break;  /* +/%# */
  case CAMP:   /* x&i.     { y"_ */
  case CFORK:  /* (x i. ]) { y"_ */
   if(hi==CQQ&&(y=hv->f,LIT&AT(y)&&1==AR(y))&&equ(ainf,hv->g)&&
       (x=fv->f,LIT&AT(x)&&1==AR(x))&&CIOTA==ID(fv->g)&&
       (fi==CAMP||CRIGHT==ID(fv->h))){f1=jtcharmapb; flag &=~(VINPLACEOK1);} break;
  case CAT:    /* <"1@[ { ] */
   if(gi==CLBRACE&&hi==CRIGHT){                                   
    p=fv->f; q=fv->g; 
    if(CLEFT==ID(q)&&CQQ==ID(p)&&(v=VAV(p),x=v->f,CLT==ID(x)&&equ(one,v->g))){f2=jtsfrom; flag &=~(VINPLACEOK2);}
 }}
 switch(fi==CCAP?gi:hi){
  case CQUERY:  if(hi==CDOLLAR||hi==CPOUND){f2=jtrollk; flag &=~(VINPLACEOK2);}  break;
  case CQRYDOT: if(hi==CDOLLAR||hi==CPOUND){f2=jtrollkx; flag &=~(VINPLACEOK2);} break;
  case CICAP:   m=7; if(fi==CCAP){if(hi==CNE)f1=jtnubind; else if(FIT0(CNE,hv)){f1=jtnubind0; flag &=~(VINPLACEOK1);}} break;
  case CSLASH:  c=ID(gv->f); m=c==CPLUS?4:c==CPLUSDOT?5:c==CSTARDOT?6:-1; 
                if(fi==CCAP&&vaid(gv->f)&&vaid(h)){f2=jtfslashatg; flag &=~(VINPLACEOK2);}
                break;
  case CFCONS:  if(hi==CFCONS){x=hv->h; j=*BAV(x); m=B01&AT(x)?(gi==CIOTA?j:gi==CICO?2+j:-1):-1;} break;
  case CRAZE:   if(hi==CLBRACE){f2=jtrazefrom; flag &=~(VINPLACEOK2);}
                else if(hi==CCUT){
                 j=i0(hv->g);
                 if(CBOX==ID(hv->f)&&!j){f2=jtrazecut0; flag &=~(VINPLACEOK2);}
                 else if(boxatop(h)&&j&&-2<=j&&j<=2){f1=jtrazecut1; f2=jtrazecut2; flag &=~(VINPLACEOK1|VINPLACEOK2);}
 }}
 if(0<=m){
  v=4<=m?hv:fv; b=CFIT==v->id&&equ(zero,v->g);
  switch(b?ID(v->f):v->id){
   case CEQ:   f2=b?jtfolkcomp0:jtfolkcomp; flag|=0+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
   case CNE:   f2=b?jtfolkcomp0:jtfolkcomp; flag|=1+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
   case CLT:   f2=b?jtfolkcomp0:jtfolkcomp; flag|=2+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
   case CLE:   f2=b?jtfolkcomp0:jtfolkcomp; flag|=3+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
   case CGE:   f2=b?jtfolkcomp0:jtfolkcomp; flag|=4+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
   case CGT:   f2=b?jtfolkcomp0:jtfolkcomp; flag|=5+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
   case CEBAR: f2=b?jtfolkcomp0:jtfolkcomp; flag|=6+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
   case CEPS:  f2=b?jtfolkcomp0:jtfolkcomp; flag|=7+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
 }}
 // If this fork is not a special form, set the flags to indicate whether the f verb does not use an
 // argument.  In that case h can inplace the unused aegument.
 if(f1==jtfolk1 && f2==jtfolk2) flag |= atoplr(f);
 R fdef(CFORK,VERB, f1,f2, f,g,h, flag, RMAX,RMAX,RMAX);
}
예제 #14
0
파일: sdrcmd.c 프로젝트: alring/sdrlib
int parseAndExecute(SdrLib *sdr, char *buf)
{
    int len = strlen(buf);
    if (len > 0 && buf[len-1]=='\n')
        {
        len--;
        buf[len] = '\0';
        }
    int i = 0;
    for (i=0 ; i < len ; i++)
        buf[i] = tolower(buf[i]);
    trace("Buf:'%s'", buf);
    char *delim = " ,\t";
    char *ctx;
    char *cmd = strtok_r(buf, delim, &ctx);
    if (!cmd)
        return TRUE;
    char *p0 = strtok_r(NULL, delim, &ctx);
    
    if (equ(cmd, "exit")||equ(cmd, "quit")||equ(cmd, "q"))
        {
        return -1;
        }
    else if (equ(cmd, "start"))
        {
        sdrStart(sdr);
        }
    else if (equ(cmd, "stop"))
        {
        sdrStop(sdr);
        }
    else if (equ(cmd, "freq")||equ(cmd, "f"))
        {
        if (!p0)
            {
            double freq = sdrGetCenterFrequency(sdr);
            trace("freq: %f", freq);
            }
        else
            {
            double freq;
            if (getDouble(p0, &freq))
                {
                sdrSetCenterFrequency(sdr, freq);
                }
            }
        }
    else if (equ(cmd, "gain") || equ(cmd, "g"))
        {
        if (!p0)
            {
            float gain = sdrGetRfGain(sdr);
            trace("gain: %f", gain);
            }
        else
            {
            float gain;
            if (getFloat(p0, &gain))
                {
                if (gain < 0.0 || gain > 1.0)
                    {
                    error("Gain must be in the range 0.0 .. 1.0");
                    }
                else
                    sdrSetRfGain(sdr, gain);
                }
            }
        }
    else if (equ(cmd, "vfo") || equ(cmd, "v"))
        {
        if (!p0)
            {
            float f = sdrGetVfo(sdr);
            trace("vfo: %f", f);
            }
        else
            {
            float f;
            if (getFloat(p0, &f))
                {
                sdrSetVfo(sdr, f);
                }
            }
        }
    else if (equ(cmd, "lo"))
        {
        if (!p0)
            {
            float f = sdrGetPbLo(sdr);
            trace("pblo: %f", f);
            }
        else
            {
            float f;
            if (getFloat(p0, &f))
                {
                sdrSetPbLo(sdr, f);
                }
            }
        }
    else if (equ(cmd, "hi"))
        {
        if (!p0)
            {
            float f = sdrGetPbHi(sdr);
            trace("pbhi: %f", f);
            }
        else
            {
            float f;
            if (getFloat(p0, &f))
                {
                sdrSetPbHi(sdr, f);
                }
            }
        }
    else
        {
        error("Unimplemented command:'%s'", cmd);
        }

    return TRUE;
}
예제 #15
0
void Ponts30::build_equ() {

    const ExprSymbol& O_y=ExprSymbol::new_("O_y");
    const ExprSymbol& O_x=ExprSymbol::new_("O_x");
    const ExprSymbol& N_y=ExprSymbol::new_("N_y");
    const ExprSymbol& N_x=ExprSymbol::new_("N_x");
    const ExprSymbol& M_y=ExprSymbol::new_("M_y");
    const ExprSymbol& M_x=ExprSymbol::new_("M_x");
    const ExprSymbol& L_y=ExprSymbol::new_("L_y");
    const ExprSymbol& L_x=ExprSymbol::new_("L_x");
    const ExprSymbol& K_y=ExprSymbol::new_("K_y");
    const ExprSymbol& K_x=ExprSymbol::new_("K_x");
    const ExprSymbol& J_y=ExprSymbol::new_("J_y");
    const ExprSymbol& J_x=ExprSymbol::new_("J_x");
    const ExprSymbol& I_y=ExprSymbol::new_("I_y");
    const ExprSymbol& I_x=ExprSymbol::new_("I_x");
    const ExprSymbol& H_y=ExprSymbol::new_("H_y");
    const ExprSymbol& H_x=ExprSymbol::new_("H_x");
    const ExprSymbol& G_y=ExprSymbol::new_("G_y");
    const ExprSymbol& G_x=ExprSymbol::new_("G_x");
    const ExprSymbol& F_y=ExprSymbol::new_("F_y");
    const ExprSymbol& F_x=ExprSymbol::new_("F_x");
    const ExprSymbol& E_y=ExprSymbol::new_("E_y");
    const ExprSymbol& E_x=ExprSymbol::new_("E_x");
    const ExprSymbol& D_y=ExprSymbol::new_("D_y");
    const ExprSymbol& D_x=ExprSymbol::new_("D_x");
    const ExprSymbol& C_y=ExprSymbol::new_("C_y");
    const ExprSymbol& C_x=ExprSymbol::new_("C_x");
    const ExprSymbol& B_y=ExprSymbol::new_("B_y");
    const ExprSymbol& B_x=ExprSymbol::new_("B_x");
    const ExprSymbol& A_y=ExprSymbol::new_("A_y");
    const ExprSymbol& A_x=ExprSymbol::new_("A_x");

    Array<const ExprSymbol> symbols(30);
    int i=0;
    symbols.set_ref(i++,O_y);
    symbols.set_ref(i++,O_x);
    symbols.set_ref(i++,N_y);
    symbols.set_ref(i++,N_x);
    symbols.set_ref(i++,M_y);
    symbols.set_ref(i++,M_x);
    symbols.set_ref(i++,L_y);
    symbols.set_ref(i++,L_x);
    symbols.set_ref(i++,K_y);
    symbols.set_ref(i++,K_x);
    symbols.set_ref(i++,J_y);
    symbols.set_ref(i++,J_x);
    symbols.set_ref(i++,I_y);
    symbols.set_ref(i++,I_x);
    symbols.set_ref(i++,H_y);
    symbols.set_ref(i++,H_x);
    symbols.set_ref(i++,G_y);
    symbols.set_ref(i++,G_x);
    symbols.set_ref(i++,F_y);
    symbols.set_ref(i++,F_x);
    symbols.set_ref(i++,E_y);
    symbols.set_ref(i++,E_x);
    symbols.set_ref(i++,D_y);
    symbols.set_ref(i++,D_x);
    symbols.set_ref(i++,C_y);
    symbols.set_ref(i++,C_x);
    symbols.set_ref(i++,B_y);
    symbols.set_ref(i++,B_x);
    symbols.set_ref(i++,A_y);
    symbols.set_ref(i++,A_x);

    // (reverse order)
//	const ExprSymbol& A_y=ExprSymbol::new_("A_y");
//	const ExprSymbol& B_x=ExprSymbol::new_("B_x");
//	const ExprSymbol& B_y=ExprSymbol::new_("B_y");
//	const ExprSymbol& C_x=ExprSymbol::new_("C_x");
//	const ExprSymbol& C_y=ExprSymbol::new_("C_y");
//	const ExprSymbol& D_x=ExprSymbol::new_("D_x");
//	const ExprSymbol& D_y=ExprSymbol::new_("D_y");
//	const ExprSymbol& E_x=ExprSymbol::new_("E_x");
//	const ExprSymbol& E_y=ExprSymbol::new_("E_y");
//	const ExprSymbol& F_x=ExprSymbol::new_("F_x");
//	const ExprSymbol& F_y=ExprSymbol::new_("F_y");
//	const ExprSymbol& G_x=ExprSymbol::new_("G_x");
//	const ExprSymbol& G_y=ExprSymbol::new_("G_y");
//	const ExprSymbol& H_x=ExprSymbol::new_("H_x");
//	const ExprSymbol& H_y=ExprSymbol::new_("H_y");
//	const ExprSymbol& I_x=ExprSymbol::new_("I_x");
//	const ExprSymbol& I_y=ExprSymbol::new_("I_y");
//	const ExprSymbol& J_x=ExprSymbol::new_("J_x");
//	const ExprSymbol& J_y=ExprSymbol::new_("J_y");
//	const ExprSymbol& K_x=ExprSymbol::new_("K_x");
//	const ExprSymbol& K_y=ExprSymbol::new_("K_y");
//	const ExprSymbol& L_x=ExprSymbol::new_("L_x");
//	const ExprSymbol& L_y=ExprSymbol::new_("L_y");
//	const ExprSymbol& M_x=ExprSymbol::new_("M_x");
//	const ExprSymbol& M_y=ExprSymbol::new_("M_y");
//	const ExprSymbol& N_x=ExprSymbol::new_("N_x");
//	const ExprSymbol& N_y=ExprSymbol::new_("N_y");
//	const ExprSymbol& O_x=ExprSymbol::new_("O_x");
//	const ExprSymbol& O_y=ExprSymbol::new_("O_y");

    Array<const ExprNode> equ(30);
    i=0;

    equ.set_ref(i++,(	sqr(N_x - O_x) + sqr(N_y - O_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(M_x - O_x) + sqr(M_y - O_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(M_x - N_x) + sqr(M_y - N_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(J_x - N_x) + sqr(J_y - N_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(L_x - M_x) + sqr(L_y - M_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(K_x - M_x) + sqr(K_y - M_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(G_x - L_x) + sqr(G_y - L_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(K_x - L_x) + sqr(K_y - L_y) - 0.089999999999999997 ));
    equ.set_ref(i++,(	sqr(J_x - K_x) + sqr(J_y - K_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(K_x - N_x) + sqr(K_y - N_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(I_x - J_x) + sqr(I_y - J_y) - 9 ));
    equ.set_ref(i++,(	sqr(H_x - J_x) + sqr(H_y - J_y) - 25 ));
    equ.set_ref(i++,(	sqr(B_x - I_x) + sqr(B_y - I_y) - 25 ));
    equ.set_ref(i++,(	sqr(A_x - I_x) + sqr(A_y - I_y) - 4 ));
    equ.set_ref(i++,(	sqr(B_x - H_x) + sqr(B_y - H_y) - 9 ));
    equ.set_ref(i++,(	sqr(H_x - I_x) + sqr(H_y - I_y) - 16 ));
    equ.set_ref(i++,(	sqr(F_x - G_x) + sqr(F_y - G_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(C_x - G_x) + sqr(C_y - G_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(F_x - L_x) + sqr(F_y - L_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(D_x - F_x) + sqr(D_y - F_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(D_x - E_x) + sqr(D_y - E_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(E_x - F_x) + sqr(E_y - F_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(D_x - G_x) + sqr(D_y - G_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(C_x - D_x) + sqr(C_y - D_y) - 0.0625 ));
    equ.set_ref(i++,(	sqr(C_x - H_x) + sqr(C_y - H_y) - 18.003049000000004 ));
    equ.set_ref(i++,(	sqr(B_x - C_x) + sqr(B_y - C_y) - 9 ));
    equ.set_ref(i++,(	sqr(A_x - B_x) + sqr(A_y - B_y) - 25 ));
    equ.set_ref(i++,(	B_x ));
    equ.set_ref(i++,(	A_y ));
    equ.set_ref(i++,(	A_x ));

    f =  new Function(symbols,ExprVector::new_(equ,false),"ponts30");
}
예제 #16
-1
파일: Unit1.cpp 프로젝트: Aetet/labs
void __fastcall TForm1::Button1Click(TObject *Sender)
{
        memset(_b,0,sizeof(_b));
        memset(_a,0,sizeof(_a));
        int i;
        int n=4;
        int e2=Edit2->Text.Length();
        int e3=Edit3->Text.Length();
        for(i=1; i<=n; i++)
                _a[n-i]= (AnsiString("0x0")+Edit2->Text.SubString(e2>=8*i?e2-8*i+1:1,e2>=8*i?8:(e2-8*(i-1)>0?e2-8*(i-1):0))).ToInt();
        for(i=1; i<=n; i++)
                _a[n-i+n]= (AnsiString("0x0")+Edit3->Text.SubString(e3>=8*i?e3-8*i+1:1,e3>=8*i?8:(e3-8*(i-1)>0?e3-8*(i-1):0))).ToInt();
        // n=2

      /*  equ(4, 1, 1);
        sub(4, 0, 1);
        equ(5, 2, 1);
        sub(5, 3, 1);
        xchg(1, 2, 1);
        mul(0, 1, 1);
        mul(2, 3, 1);
        mul(4, 5, 1);
        add(4, 0, 2);
        add(4, 2, 2);
        add(1, 4, 2);    /* */


        // n=4

        equ(12, 2, 2);
        sub(12, 0, 2);
        equ(14, 4, 2);
        sub(14, 6, 2);
        xchg(2, 4, 2);
        equ(8, 1, 1);
        sub(8, 0, 1);
        equ(9, 2, 1);
        sub(9, 3, 1);
        xchg(1, 2, 1);
        equ(10, 5, 1);
        sub(10, 4, 1);
        equ(11, 6, 1);
        sub(11, 7, 1);
        xchg(5, 6, 1);
        equ(16, 13, 1);
        sub(16, 12, 1);
        equ(17, 14, 1);
        sub(17, 15, 1);
        xchg(13, 14, 1);
        mul(0, 1, 1);
        mul(2, 3, 1);
        mul(8, 9, 1);
        mul(4, 5, 1);
        mul(6, 7, 1);
        mul(10, 11, 1);
        mul(12, 13, 1);
        mul(14, 15, 1);
        mul(16, 17, 1);
        add(8, 0, 2);
        add(8, 2, 2);
        add(1, 8, 2);
        add(10, 4, 2);
        add(10, 6, 2);
        add(5, 10, 2);
        add(16, 12, 2);
        add(16, 14, 2);
        add(13, 16, 2);
        add(12, 0, 4);
        add(12, 4, 4);
        add(2, 12, 4);   /*  */

        Edit4->Text="";

        for(i=0; i<n+n; i++)
                Edit4->Text=Edit4->Text+IntToHex((int)_a[i],8);
}