Advertisement
Fahim_7861

Second order polynomial

May 1st, 2021
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. typedef pair<ll,ll>pll;
  5. #define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
  6. #define eb emplace_back
  7. #define F first
  8. #define S second
  9. int main()
  10. {
  11.  
  12. fastread();
  13.  
  14. ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;
  15.  
  16. bool flag=false;
  17.  
  18.  
  19. ll xc,yc,x,y;
  20.  
  21.  
  22. string str;
  23.  
  24. cout<<"Input the radius r and center x,y"<<endl;
  25.  
  26. cin>>r>>xc>>yc;
  27.  
  28.  
  29.  
  30. cout<<"\nX y=sqrt("<<r*r<<"- x^2) Round(y)"<<endl;
  31.  
  32. i=1;
  33.  
  34. vector<pll>v;
  35.  
  36. x=0;
  37.  
  38.  
  39.  
  40.  
  41. double yy=(double)sqrt((r*r)-(x*x));
  42.  
  43. y=round(yy);
  44.  
  45.  
  46.  
  47. while(x<=y)
  48. {
  49.  
  50. v.eb(x,y);
  51.  
  52. cout<<x<<" "<<setprecision(2)<<fixed<<yy<<" "<<y<<endl;
  53.  
  54. x++;
  55.  
  56. yy=(double)sqrt((r*r)-(x*x));
  57.  
  58. y=round(yy);
  59.  
  60.  
  61.  
  62.  
  63.  
  64. }
  65.  
  66.  
  67.  
  68. cout<<"\nXc : "<<xc<<",Yc:"<<yc<<endl;
  69.  
  70. cout<<"( x, y) ";
  71.  
  72. for(auto x : v)
  73. {
  74. cout<<"( "<<x.F<<","<<x.S<<") ";
  75. }
  76.  
  77. cout<<endl<<endl;
  78.  
  79. cout<<"( x+"<<xc<<",y+"<<yc<<") ";
  80.  
  81. for(auto x : v)
  82. {
  83. cout<<"( "<<x.F+xc<<","<<x.S+yc<<") ";
  84. }
  85.  
  86. cout<<endl<<endl;
  87.  
  88.  
  89.  
  90. cout<<"( -x+"<<xc<<",y+"<<yc<<") ";
  91.  
  92. for(auto x : v)
  93. {
  94. cout<<"( "<<-x.F+xc<<","<<x.S+yc<<") ";
  95. }
  96.  
  97. cout<<endl<<endl;
  98.  
  99.  
  100. cout<<"( x+"<<xc<<",-y+"<<yc<<") ";
  101.  
  102. for(auto x : v)
  103. {
  104. cout<<"( "<<x.F+xc<<","<<-x.S+yc<<") ";
  105. }
  106.  
  107. cout<<endl<<endl;
  108.  
  109. cout<<"( -x+"<<xc<<",-y+"<<yc<<") ";
  110.  
  111. for(auto x : v)
  112. {
  113. cout<<"( "<<-x.F+xc<<","<<-x.S+yc<<") ";
  114. }
  115.  
  116. cout<<endl<<endl;
  117.  
  118. cout<<"( y+"<<xc<<",x+"<<yc<<") ";
  119.  
  120. for(auto x : v)
  121. {
  122. cout<<"( "<<x.S+xc<<","<<x.F+yc<<") ";
  123. }
  124.  
  125. cout<<endl<<endl;
  126.  
  127.  
  128. cout<<"( y+"<<xc<<",-x+"<<yc<<") ";
  129.  
  130. for(auto x : v)
  131. {
  132. cout<<"( "<<x.S+xc<<","<<-x.F+yc<<") ";
  133. }
  134.  
  135. cout<<endl<<endl;
  136.  
  137.  
  138. cout<<"( -y+"<<xc<<",x+"<<yc<<") ";
  139.  
  140. for(auto x : v)
  141. {
  142. cout<<"( "<<-x.S+xc<<","<<x.F+yc<<") ";
  143. }
  144.  
  145. cout<<endl<<endl;
  146.  
  147. cout<<"( -y+"<<xc<<",-x+"<<yc<<") ";
  148.  
  149. for(auto x : v)
  150. {
  151. cout<<"( "<<-x.S+xc<<","<<-x.F+yc<<") ";
  152. }
  153.  
  154. cout<<endl;
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167. return 0;
  168.  
  169.  
  170. }
  171.  
  172.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement