Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- #define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
- 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;
- string str;
- ll x1,x2,y1,y2;
- cin>>x1>>y1>>x2>>y2;
- ll delx= abs(x2-x1);
- ll dely = abs(y2-y1);
- ll Twodely = dely*2;
- ll TwoDelyMinus2delx = Twodely - (2*delx);
- p = Twodely - delx;
- ll preP=p;
- cout<<endl;
- cout<<"K Pk (Xk+1 , Yk+1)"<<endl;
- cout<<endl<<endl;
- for(ll k=0; k<delx; k++)
- {
- if(p<0)
- {
- p = p+Twodely;
- x1++;
- }
- else{
- p= p+TwoDelyMinus2delx;
- x1++;
- y1++;
- }
- cout<<k<<" "<<preP<<" ("<<x1<<" "<<y1<<")"<<endl;
- preP=p;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment