Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- typedef pair<ll,ll>pll;
- #define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
- #define eb emplace_back
- #define F first
- #define S second
- int main()
- {
- fastread();
- ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;
- bool flag=false;
- ll xc,yc,x,y;
- string str;
- cout<<"Input the radius r and center x,y"<<endl;
- cin>>r>>xc>>yc;
- cout<<"\nX y=sqrt("<<r*r<<"- x^2) Round(y)"<<endl;
- i=1;
- vector<pll>v;
- x=0;
- double yy=(double)sqrt((r*r)-(x*x));
- y=round(yy);
- while(x<=y)
- {
- v.eb(x,y);
- cout<<x<<" "<<setprecision(2)<<fixed<<yy<<" "<<y<<endl;
- x++;
- yy=(double)sqrt((r*r)-(x*x));
- y=round(yy);
- }
- cout<<"\nXc : "<<xc<<",Yc:"<<yc<<endl;
- cout<<"( x, y) ";
- for(auto x : v)
- {
- cout<<"( "<<x.F<<","<<x.S<<") ";
- }
- cout<<endl<<endl;
- cout<<"( x+"<<xc<<",y+"<<yc<<") ";
- for(auto x : v)
- {
- cout<<"( "<<x.F+xc<<","<<x.S+yc<<") ";
- }
- cout<<endl<<endl;
- cout<<"( -x+"<<xc<<",y+"<<yc<<") ";
- for(auto x : v)
- {
- cout<<"( "<<-x.F+xc<<","<<x.S+yc<<") ";
- }
- cout<<endl<<endl;
- cout<<"( x+"<<xc<<",-y+"<<yc<<") ";
- for(auto x : v)
- {
- cout<<"( "<<x.F+xc<<","<<-x.S+yc<<") ";
- }
- cout<<endl<<endl;
- cout<<"( -x+"<<xc<<",-y+"<<yc<<") ";
- for(auto x : v)
- {
- cout<<"( "<<-x.F+xc<<","<<-x.S+yc<<") ";
- }
- cout<<endl<<endl;
- cout<<"( y+"<<xc<<",x+"<<yc<<") ";
- for(auto x : v)
- {
- cout<<"( "<<x.S+xc<<","<<x.F+yc<<") ";
- }
- cout<<endl<<endl;
- cout<<"( y+"<<xc<<",-x+"<<yc<<") ";
- for(auto x : v)
- {
- cout<<"( "<<x.S+xc<<","<<-x.F+yc<<") ";
- }
- cout<<endl<<endl;
- cout<<"( -y+"<<xc<<",x+"<<yc<<") ";
- for(auto x : v)
- {
- cout<<"( "<<-x.S+xc<<","<<x.F+yc<<") ";
- }
- cout<<endl<<endl;
- cout<<"( -y+"<<xc<<",-x+"<<yc<<") ";
- for(auto x : v)
- {
- cout<<"( "<<-x.S+xc<<","<<-x.F+yc<<") ";
- }
- cout<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement