মঙ্গলবার, ১২ জানুয়ারী, ২০১৬

               solve lightOJ 1305 - Area of a Parallelogram  in c++






#include<iostream>
#include<math.h>
using namespace std;

int main()

{
    int ax, ay, bx, by, cx, cy, dx, dy, t, s;
    cin >> t;
    for(int i =1; i <= t; i++)
    {
       cin >> ax >> ay >> bx >> by >> cx >> cy;
       dx = ax + cx - bx;
       dy = ay + cy - by;
       s = fabs((ax * by + bx * cy + cx * ay) - (bx * ay + cx * by + ax * cy));

       cout << "Case " << i << ": " << dx  << " "  << dy << " " << s << endl;

    }
    return 0;
}

____ahmed shuvo 969

           solve lightOj 1331 - Agent J in c++



#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;
#define PI acos(-1)
int main()
{
    int t, i;
    double res, tri_area, r1, r2, r3, a, b, c, angle_a, angle_b, angle_c, area_r1, area_r2, area_r3, s;
    cin >> t;
    for(i = 1; i <= t; i++)
    {
        cin >> r1 >> r2 >> r3;
        a = r1 + r2;
        b = r1 + r3;
        c = r2 + r3;
        angle_a = acos((b*b + c*c - a*a) / (2 * b * c)) * 180.0/PI;
        angle_b = acos((a*a + c*c - b*b) / (2 * a * c)) * 180.0/PI;
        angle_c = acos((b*b + a*a - c*c) / (2 * b * a)) * 180.0/PI;
        area_r1 = 0.5 * (r1 * r1) * (angle_c * (PI/180.0));
        area_r2 = 0.5 * (r2 * r2) * (angle_b * (PI/180.0));
        area_r3 = 0.5 * (r3 * r3) * (angle_a * (PI/180.0));
        s = (a + b + c) / 2.0;
        tri_area = sqrt(s * (s - a) * (s - b) * (s - c));
        res = tri_area - (area_r1 + area_r2 + area_r3);
        cout << "Case " << i << ": " << fixed << setprecision(10) << res << endl;
    }
    return 0;
}


ahmed shuvo 969

                                   

solve  in c++




#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int t, test;
    double ox, oy, ax, ay, bx, by, a, b, o, angle_o, min_dis;
    cin >> test;
    for(t = 1; t <= test; t++)
    {
        cin >> ox >> oy >> ax >> ay >> bx >> by;
        b = sqrt((ox - ax) * (ox - ax) + (oy - ay) * (oy - ay));
        a = sqrt((ox - bx) * (ox - bx) + (oy - by) * (oy - by));
        o = sqrt((bx - ax) * (bx - ax) + (by - ay) * (by - ay));
        angle_o = acos((b*b + a*a - o*o)/(2 * b * a));
        min_dis = a * angle_o;
        cout << "Case " << t << ": " << fixed << setprecision(8) << min_dis << endl;
    }
    return 0;
}



___ahmed shuvo 969

সোমবার, ১১ জানুয়ারী, ২০১৬

               solve Fibonacci series in c++



 #include<iostream>
using namespace std;

int main()

{
    int first = 0, second = 1, next, n;
    cout << "Enter the term number: ";
    cin >> n;
    for(int i = 0; i <= n; i++)
    {
        if( i <= 1)
            next = i;
        else
        {
            next = first + second;
            first = second;
            second = next;
        }
        cout << next << " ";
    }

    return 0;

}


///ahmed shuvo 969

শনিবার, ৯ জানুয়ারী, ২০১৬


LIGHT OJ NO: 1053



#include<iostream>
#include<math.h>
using namespace std;

int main()
{
   long int T, a, b, c, l, s, m;
    double d;
    cin >> T;
   for(int i = 1; i <= T; i++)
    {
        cin >> a >> b >> c;
        if( a> b && a > c)
            {
            l = a;
            m = b;
            s = c;
            }
        else if ( b > a && b > c)
           {
            l = b;
            m = a;
            s = c;
           }
        else
        {
            l = c;
            m = b;
            s = a;
        }
        d = acos((s * s + m * m - l * l)/ 2 * s * m) * ( 180 / acos(-1));
        if(d == 90)
            cout << "Case " << i << ": " << "yes" << endl;
        else
            cout << "Case " << i << ": " << "no" << endl;
   }

    return 0;
}



___ahmed shuvo 969

শুক্রবার, ৮ জানুয়ারী, ২০১৬

              solve lightOj 1000 in c++


#include<iostream>
using namespace std;

int main()
{
    int a, b, t;
    cin>> t;
    for(int i = 1; i <= t; i++)
    {
        cin >> a >> b;
        cout << "Case " << i << ": " << a + b << endl;
    }

    return 0;
}

_____ahmede shuvo 969
solve lightOj 1015 - Brush (I) in c++


#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
    long long int tst,t,num,tp,sum,i;
    cin>>tst;
    for(t=1;t<=tst;t++)
    {
        sum=0;
        cin>>num;
        for(i=0;i<num;i++)
        {
            cin>>tp;
            if(tp>0)
            {
                sum=sum+tp;
            }
        }
        cout<<"Case "<<t<<": "<<sum<<endl;
    }
    return 0;
}


///ahmed shuvo 969