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;
- x=0,y=r;
- d=(3-(2*r));
- cout<<"\nIteration No(i) : (Xi,Yi) di (Xi+1,Yi+1)"<<endl;
- i=1;
- vector<pll>v;
- v.eb(x,y);
- while(x<y)
- {
- cout<<i<<" ("<<x<<","<<y<<") "<<d<<" (";
- if(d<0)
- {
- d=d+(4*x)+6;
- x++;
- }
- else{
- d=d+4*(x-y)+10;
- x++;
- y--;
- }
- cout<<x<<","<<y<<") "<<endl;
- v.eb(x,y);
- i++;
- }
- 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