About Me

About Me : I have been working as a Software Engineer for various international companies for four years.Currently, I am working as a full stack Javascript developer in Petronas(Malaysia).

Skills

Skills • Javascript •Typescript •Python •C •Java •ReactJs • Redux • VueJs • NestJs • React Testing Library • Django• PostgreSQL • MySQL • NodeJs • Git • Docker • Jira • Visual Studio Code • Slack

মঙ্গলবার, ১ সেপ্টেম্বর, ২০১৫

UVA :11933 - Splitting Numbers (way 1)

#include <bits/stdc++.h>
#define sc(a) scanf("%d",&a)
#define scd(a,b) scanf("%d%d",&a,&b)
#define sct(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define READ freopen ("input.txt","r",stdin)
#define nnn 20
using namespace std;

int main()
{
    int num;
    int a,b;
   // scanf("%d",&n);

    while(~sc(num)&&num)
    {
        bitset<32>foo(num);
       // cout<<foo[0]<<" "<<foo[1]<<" "<<foo[2]<<endl;
       // cout<<foo.size()<<endl;
       // cout<<foo<<endl;
        int c=0;

        a=b=0;
        for(int i=0; i<32; i++)
        {
            if(foo[i]==1)
            {
                c++;
                if(c%2) a=a+(1<<i);
                else b=b+(1<<i);

            }


        }
        cout<<a<<" "<<b<<endl;


    }
    return 0;
}

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন