সোমবার, ২৩ এপ্রিল, ২০১৮

UVa 10127: Ones

#include<stdio.h>
int main()
{
    int  n;
    while(scanf("%d",&n)==1)
    {
        int t=10;
        int count=1;
        int g=1;
        while(g%n!=0)
        {
            g=(g*t+1)%n;
            count++;
        }
        printf("%d\n",count);
    }

    return 0;
}

মঙ্গলবার, ১০ এপ্রিল, ২০১৮

All Possible subsequence of a number (Here number is 1234)

///...................SUBHASHIS MOLLICK...................///
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///....................SESSION-(14-15)....................///
#include<bits/stdc++.h>
using namespace std;
#define sf(a) scanf("%lld",&a)
#define sf2(a,b) scanf("lld",&a,&b)
#define sf3(a,b,c) scanf("lld%lld",&a,&b,&c)
#define pf(a) printf("%lld",a)
#define pf2(a,b) printf("lld",a,b)
#define pf3(a,b,c) printf("lld%lld",a,b,c)
#define nl printf("\n")
#define ll long long
#define pb push_back
#define MPI map<int,int>mp
#define fr(i,n) for(i=0;i<n;i++)
#define fr1(i,n) for(i=1;i<=n;i++)
#define frl(i,a,b) for(i=a;i<=b;i++)
//freopen("Input.txt","r",stdin);
//freopen("Output.txt","w",stdout);
main()
{
    long i,j,ar[]={1,2,3,4};
    for(i=0;i<16;i++)
    {
        for(j=0;j<4;j++)
        {
            if(i&(1<<j))
                cout<<ar[j];
        }
        cout<<endl;
    }
}

Factory Pattern

Factory Method  is a creational design pattern that provides an interface for creating objects in a superclass but allows subclasses to alte...