当前位置: 首页>>代码示例>>C++>>正文


C++ P类代码示例

本文整理汇总了C++中P的典型用法代码示例。如果您正苦于以下问题:C++ P类的具体用法?C++ P怎么用?C++ P使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了P类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main() {
  st.eat();
  scanf( "%lf", &vp );
  cur.eat();
  scanf( "%lf%lf", &v, &r );
  R = st.mag();
  o = vp / R;
  s = ang( st );
  t = ang( cur );

  Q = t - s;
  while ( Q < -EPS ) Q += 2 * PI;

  double up = 1e9, lo = 0;

  while ( up > lo + 1e-10 ) {
    double mid = (up + lo) / 2.0;

    double ang = s + o * mid;

    P p = P( R * cos(ang), R * sin(ang) );

    double d = dist( p, cur );

    if ( d < mid * v + EPS ) {
      up = mid;
    } else {
      lo = mid;
    }
  }

  printf( "%.9f\n", up);

	return 0;
}
开发者ID:199911,项目名称:acm,代码行数:35,代码来源:198c.cpp

示例2: main

int main() {
    int T;
    scanf("%d", &T);
    while (T--) {
        double x1, y1, x2, y2, x3, y3;
        scanf("%lf%lf", &x1, &y1);
        scanf("%lf%lf", &x2, &y2);
        scanf("%lf%lf", &x3, &y3);
        const P p = center(P(x1, y1), P(x2, y2), P(x3, y3));
        printf("%.3f %.3f %.3f\n", p.real(), p.imag(), abs(p-P(x1, y1)));
    }
    return 0;
}
开发者ID:kohyatoh,项目名称:contests,代码行数:13,代码来源:0010.cpp

示例3: solve

 double solve()  
 {  
     u.read();v.read();  
     int k1,k2;  
     k1=mid((u-v).angle());  
     k2=mid((v-u).angle());  
     double t1=(u-v)*(p[k1]-v);  
     double t2=(u-v)*(p[k2]-v);  
     if(t1*t2>-eps)return 0.0;  
     double s1,s2;  
     P a,b;  
     s1=s2=0.0;  
     a=calc(k1,k2,s1,s2);  
     b=calc(k2,k1,s2,s1);  
     s1+=a*b;  
     s2+=b*a;  
     return min(s1,s2)/2.0;  
 }  
开发者ID:footoredo,项目名称:Gungnir,代码行数:18,代码来源:pa1.cpp

示例4: switch

void PlayerInfo::onReceiveCommand(int32_t clientId, sf::Packet& packet)
{
    if (clientId != this->clientId) return;
    int16_t command;
    packet >> command;
    switch(command)
    {
    case CMD_UPDATE_CREW_POSITION:
        {
            int32_t position;
            bool active;
            packet >> position >> active;
            crew_position[position] = active;
            
            if (isMainScreen())
                main_screen_control = false;
            if (active && mySpaceship)
            {
                int main_screen_control_cnt = 0;
                foreach(PlayerInfo, i, playerInfoList)
                {
                    if (i->ship_id == mySpaceship->getMultiplayerId() && i->main_screen_control)
                        main_screen_control_cnt++;
                }
                if (main_screen_control_cnt == 0)
                    main_screen_control = true;
            }
        }
        break;
    case CMD_UPDATE_SHIP_ID:
        packet >> ship_id;
        break;
    case CMD_UPDATE_MAIN_SCREEN_CONTROL:
        packet >> main_screen_control;
        break;
    }
开发者ID:,项目名称:,代码行数:36,代码来源:

示例5: _distance

 double _distance(const P& lhs, const P& rhs)
 {
     const P d = lhs - rhs;
     return std::sqrt(d.x() * d.x() + d.y() * d.y());
 }
开发者ID:ShigekiKarita,项目名称:Ra,代码行数:5,代码来源:concept.hpp

示例6: toString

    const std::string toString() const {
        std::stringstream ss;
        ss << "Point(" << myPoint.toString() << ")";

        return ss.str();
    }
开发者ID:Poxelcoll,项目名称:Poxelcoll,代码行数:6,代码来源:DataTypes.hpp

示例7: translate

 const std::shared_ptr<const ConvexCCWPolygon> translate(P p) const {
     return std::shared_ptr<const ConvexCCWPolygon>(
                new Point(P(myPoint.gX() + p.gX(), myPoint.gY() + p.gY())));
 }
开发者ID:Poxelcoll,项目名称:Poxelcoll,代码行数:4,代码来源:DataTypes.hpp

示例8: while

main()
{
    int n,l;
    while(1)
    {
        q1=_q[0],q2=_q[1];
        heap.n=1;
        test.set();
        test.get();
        scanf("%d",&n);
        test.ball=n;
        /*open(test);
        node=20;
        while(heap.n>1 && heap.n<9000 && node--)
            open(heap.exmin());*/
        best.set();
        best.score=2147483647;
        // Greedy Search
        /*while(test.num>0)
        {
            best.set();
            best.score=2147483647;
            if(best.pn>0)
            {
                test.add(best.path[0].x,best.path[0].y);
                printf("%d %d\n",best.path[0].x+1,best.path[0].y+1);
            }*/

        tp[5]=test;
        dfs(5,0,0);
        //}
        //----------------------------------------------------------------
        best.print();
    }
}
开发者ID:dk00,项目名称:old-stuff,代码行数:35,代码来源:s1.cpp

示例9: next_permutation

 void next_permutation(){
     p.rotate(1);
     int i=1;
     while (++count[i] > i){
         count[i++] = 0;
         p.rotate( i );
     }
 }
开发者ID:CCJY,项目名称:coliru,代码行数:8,代码来源:main.cpp

示例10: restore

		void restore() {
			switch (u8.type) {
				case Variant::U8: return u8.restore();
				case Variant::U16: return u16.restore();
				case Variant::U32: return u32.restore();
				case Variant::U64: return u64.restore();
				case Variant::U128: return u128.restore();
				default: SYSLOG("patcher @ unsupported patch type %d, cannot restore", static_cast<int>(u8.type));
			}
		}
开发者ID:Ar4erR07,项目名称:AppleALC,代码行数:10,代码来源:kern_patcher_private.hpp

示例11: main

int main() {
    int m, n, k;
    int isUp = -1;
    cin >> m >> n >> k;
    p_m.totalNums = m;
    p_n.totalNums = n;
    for (int i=0; i<k; i++) {
        double tmp;
        cin >> tmp;
        double pm = p_m.add(tmp);
        double pn = p_n.add(tmp);
        if (i+1 >= n) {
            if (pm > pn && isUp != 1) {
                isUp = 1;
                cout << "BUY ON DAY " << i+1 << endl;
            } else if (pm < pn && isUp != 0) {
                isUp = 0;
                cout << "SELL ON DAY " << i+1 << endl;
            }
        }
    }
    return 0;
}
开发者ID:syan1987,项目名称:ACM-ICPC,代码行数:23,代码来源:main.cpp

示例12: main

int main()
{
  sf("%d%d%d%d",&xa,&ya,&xb,&yb);
  sf("%d",&n);
  ren[1].x=xa;ren[1].y=ya;
  ren[2].x=xb;ren[2].y=ya;
  ren[3].x=xa;ren[3].y=yb;
  ren[4].x=xb;ren[4].y=yb;
  k=4;
  for (i=min(ya,yb)+1;i<=max(ya,yb)-1;i++)
  {
    k++;
    ren[k].x=xa;ren[k].y=i;
    k++;
    ren[k].x=xb;ren[k].y=i;
  }
  for (i=min(xa,xb)+1;i<=max(xa,xb)-1;i++)
  {
    k++;
    ren[k].x=i;ren[k].y=ya;
    k++;
    ren[k].x=i;ren[k].y=yb;
  }
  for (i=1;i<=n;i++)
  {
    dian.input();
    sf("%d",&r);
    for (j=1;j<=k;j++)
      if (dst(dian,ren[j])<=r)
        ff[j]=1;
  }
  for (i=1;i<=k;i++)
    if (!ff[i])
      m++;
  cout<<m<<endl;
  return 0;
}
开发者ID:justzx2011,项目名称:mfs6174-ACM,代码行数:37,代码来源:CF103B.cpp

示例13: input

 void input()
 {
   s.input();e.input();
 }
开发者ID:mfs6174,项目名称:MCMToolkit,代码行数:4,代码来源:T3-finegrid.cpp

示例14: print

 void print() {
     cerr << p.real() << " " << p.imag() << " " << r << endl;
 }
开发者ID:yurahuna,项目名称:procon_library,代码行数:3,代码来源:geometry.cpp

示例15: scanf

 const C &input() { 
     mid.input(); 
     scanf("%lf", &r); 
     return *this;
 } 
开发者ID:dlw520,项目名称:STL,代码行数:5,代码来源:圆的面积并.cpp


注:本文中的P类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。