Thursday 22 December 2016

Codeforces Round #388 (Div. 2)/B. Parallelogram is Back

Problem: Codeforces Round #388 (Div. 2)/B. Parallelogram is Back
Hints:                                        
এই তিন উপায়ে তিনটি সামান্তরিক তৈরি করা যায়।
আমরা জানি
১)সামান্তরিকের দুটি বিপরীত বাহু সমান্তরাল
২)(x,y),(x1,y1) এবং (x2,y2),(x3,y3)  দ্বারা গঠিত সরলরেখা দুটি সমান্তরাল হবে যদি x-x1=x2-x3 বা, x =x1+x2-x3
এবং y-y1=y2-y3 বা, y =y1+y2-y3
Code:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long x1,x2,x3,y1,y2,y3;
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3)
    {
        cout<<3<<endl;
        cout<<x1+x2-x3<<" "<<y1+y2-y3<<endl;
        cout<<x1+x3-x2<<" "<<y1+y3-y2<<endl;
        cout<<x2+x3-x1<<" "<<y2+y3-y1<<endl;
    }
    return 0;
}


No comments:

Post a Comment