Search

Blog of AsEs

Try Try && Try is The Key of Success

C++ Language Tutorial

c++ language tutorialBook Name :==> C++ Language Tutorial
Writer : ==> cplusplus.com
Language : ==> English

Click to Download

 

MCSD Certification Toolkit (Exam 70-483): Programming in C# pdf

Book Name :==> MCSD Certification Toolkit (Exam 70-483): Programming in C#
Writer : ==> Tiberiu Covaci, Rod Stephens, Vincent Varallo, Gerry O’Brien
Language : ==> English

A perfectly crafted prep guide that prepares you for the MCSD 70-483

The MCSD 70-483 exam is the entry-level Microsoft certification exam for C# developers and this must-have resource offers essential coverage of the exam that will test your competency in C# programming. Each chapter covers one of the core subject domains that comprise the exam. Among the authors are experienced trainers who advised Microsoft on the development of its certification programs, affording them a unique understanding of both the objectives and what it takes to master them. This invaluable knowledge is passed to you so that you will not only be prepared to take the exam, but also become a better C# developer

Features a step-by-step lab tutorial for each lesson covered in the book, encouraging you to practice what you’ve just learned in order to reinforce your learning
Includes an accompanying website that includes more than 100 simulated test questions and answers
Shares solutions to the hands-on labs presented in the book
Contains complete sample code
Offers a unique author approach that not only teaches you how to answer a set of exam questions but also provides you with an understanding of the underlying concepts and skills needed to succeed as a professional C# programmer
MCSD Certification Toolkit is all you need to fully prepare for exam 70-483!
C#
Click to Download

Competitive Programming.pdf By Steven Halim

Book Name :==> Competitive Programming
Writer : ==> Steven Halim
Language : ==> English

This book contains a collection of relevant data structures, algorithms, and programming tips written for University students who want to be more competitive in the ACM International Collegiate Programming Contest (ICPC), high school students who are aspiring to be competitive in the International Olympiad in Informatics (IOI), coaches for these competitions, and basically anyone who loves problem solving using computer programs .

 

CP 1

 

Click to Download

Competitive Programming 3 By Steven Halim

Book Name :==> Competitive Programming 3
Writer : ==> Steven Halim
Language : ==> English

This book is a must have for every competitive programmer. Mastering the contents of this book is a necessary (but maybe not sufficeient) condition if one wishes to take a leap forward from being just another ordinary coder to being among one of the world’s finest programmers.
Typical readers of this book would include:

University students who are competing in the annual ACM International Collegiate Programming Contest (ICPC) Regional Contests (including the World Finals)
Secondary or High School Students who are competing in the annual International Olympiad in Informatics (IOI) (including the National or Provincial Olympiads)
Coaches who are looking for comprehensive training materials for their students,
Anyone who loves solving problems through computer programs. There are numerous programming contests for those who are no longer eligible for ICPC, including TopCoder Open, Google CodeJam, Internet Problem Solving Contest (IPSC), etc.

CP 3

Click to  Download

 

Uva 12032 – The Monkey and the Oiled Bamboo

Problem Name :  The Monkey and the Oiled Bamboo

Problem Link : See Problem :  Uva 12032

Let, the height of the rungs from the ground are 2, 8, 11, 16, 21 respectively
maximum distance is 6, k=6
Jumped 2 foot from the ground to the 1st rung (ground to 1). Since I jumped less than k feet, k remains 6. 

Jumped 6 feet for the next rung (2 to 8). Since I jumped equal k feet, k becomes 5. 
Jumped 3 foot for the 3rd rung (8 to 11). So, k remains 5. 
Jumped 5 feet for the 4th rung (11 to 16). This k becomes 4. 
Jumped 5 feet for the 5th rung (16 to 21). This time i need to jump 5 but k is 4, you can’t complete the process.
So, the Ans = 6+1=7

Solution  :

#include<bits/stdc++.h>
#define pb push_back
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout)
#define rev(s) std::reverse(s.begin(), s.end())
//#define up std::transform(s.begin(), s.end(), s.begin(), ::toupper);
///string sb=s.substr(1,3);

#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

#define INF (1<<28)
#define mod 1000000007

#define PI acos(-1.0)

#define tbeg clock_t _t=clock();
#define tend cout << "\n\nTime: " << (double)(clock()-_t)/CLOCKS_PER_SEC;

//#define PI 2*acos(0.0)
//#define 2ndPI acos(-1.0)
#define lowest std::transform(s.begin(), s.end(), s.begin(), ::tolower);
#define n2s(n) stringstream ss; ss<<n; string Get=ss.str()
#define CC(x) cout<<(x)<<endl
#define srt sort(a,a+n)
#define rep(i,n) for(long long i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define pi 2*acos(0)

typedef long long LL;

using namespace std;

LL BigMod(LL B,LL P,LL M){ LL R=1; while(P>0)  {if(P&1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return (LL)R;} //compute b^p%m

int main()
{
    //read;
    //write;
    LL t, n, x, a, N, tc = 0;
    scanf("%lld",&t);
    while(t--)
    {
        LL Ans = 0;
        scanf("%lld",&n);
        scanf("%lld",&a);
        Ans = a;
        LL A[100009], T = 1;
        A[T++] = a;
        A[0] = 0;
        n = n - 1;
        while(n--)
        {
            scanf("%lld",&N);
            A[T++] = N;
            LL ans = N - a;
            Ans = max(Ans,ans);
            a = N;
        }
        LL k = Ans, ANS = 0;
        rep(i,T-1)
        {
            if((A[i+1] - A[i])==k) k--;
            else if((A[i+1] - A[i])>k){Ans = Ans + 1; break;}
        }
        printf("Case %lld: %lld\n",++tc,Ans);
    }
    return 0;

}

LightOJ 1088 – Points in Segments

Problem Name :  Points in Segments

Problem Link : See Problem : LightOJ 1088

Its also a Binary Search related Problem…
You have to find lower bound and upper bound index from  given array.
Then Subtract Upper to lower bound index.
Note : Use Scanf() and Printf() Function , cin/cout causes TLE 😛

Solution  :

#include<bits/stdc++.h>
#define read freopen("in.txt","r",stdin)
#define write freopen("out.txt","w",stdout)
#define rep(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
 
typedef long long LL;
 
using namespace std;
 
int main()
{
    //read;
    //write;
    LL l, n, x, q, N, M, I1, I2, t, tc = 0;
    scanf("%lld",&t);
    
    while(t--)
    {
        
    LL a[100005];

    scanf("%lld%lld",&n,&q);
    rep(i,n){scanf("%lld",&a[i]);}
    printf("Case %lld:\n",++tc);

    rep(i,q)
    {
        scanf("%lld%lld",&N,&M);
        LL low = 1, up = n, mid, Low, Up;
        while(low<=up)
        {
            mid = (low+up)/2;
            if(a[mid]==N){low = mid; break;}
            else if(a[mid]<N){low = mid + 1;}
            else{up = mid - 1;}
        }
        Low = low;
        low = 1, up = n, mid = 0;
        while(low<=up)
        {
            mid = (low+up)/2;
            if(a[mid]<=M){low = mid + 1;}
            else{up = mid - 1;}
        }
        Up = low;
        //cout<<Up<<" "<<Low<<endl;
        printf("%lld\n",Up-Low);
    }
    }
    return 0;
}
/*
1
5 3
1 4 6 8 10
0 5
6 10
7 100000
*/

Uva 12527 – Different Digits

Problem Name :  Different Digits

Problem Link : See Problem : Uva – 12527

Solution  :

#include<bits/stdc++.h>
#define pb push_back
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout)
#define rev(s) std::reverse(s.begin(), s.end())
//#define up std::transform(s.begin(), s.end(), s.begin(), ::toupper);
///string sb=s.substr(1,3);

#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

#define INF (1<<28)
#define mod 1000000007

#define tbeg clock_t _t=clock();
#define tend cout << "\n\nTime: " << (double)(clock()-_t)/CLOCKS_PER_SEC;

#define PI 2*acos(0.0)
#define low std::transform(s.begin(), s.end(), s.begin(), ::tolower);
#define n2s(n) stringstream ss; ss<<n; string s=ss.str()
#define CC(x) cout<<(x)<<endl
#define srt sort(a,a+n)
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)

typedef long long LL;

using namespace std;

int main()
{
    LL n, m, f, c = 0;
    while(cin>>n>>m)
    {
        c = 0;
        for(int i=n; i<=m; i++)
        {
            n2s(i);
            LL l = s.size();
            f=1;
            for(int j=0; j<l; j++)
            {
                for(int k=0; k<l; k++)
                {
                    if(k!=j)
                    {
                        if(s[j]==s[k]) {f=0; break;}
                    }
                }
                if(f==0){break;}
            }
            if(f==1) {c++;}
        }
        cout<<c<<endl;
    }
    return 0;
}

Uva 10611 – The Playboy Chimp

Problem Name :  The Playboy Chimp

Problem Link : See Problem : Uva – 10611

Its a so much easier Binary Search related Problem…
You have to think 4 Scenario for solving this problem  it will be,
1 . N(height of Luchu)<=1st Lady.
2. N>=Last Lady.
3. You will find N between heights of the all chimps.
4. Or, Exact N is  missing in heights of the all chimps !!!

Solution  :

#include<bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)

typedef long long LL;

using namespace std;


int main()
{
    LL l, n, x, q, N, temp = -99999999999999999;
    vector<LL>a;
    cin>>n;
    rep(i,n){cin>>x; if(x!=temp){a.pb(x); temp = x;}}
    n = a.size();
    cin>>q;
    rep(i,q)
    {
        cin>>N;
        LL low = 0, mid = n/2, up = n - 1, f = 1;
        if(N<=a[low]){if(a[low]==N){cout<<"X "<<a[low+1]<<endl;} else{cout<<"X "<<a[low]<<endl;}}
        else if(N>=a[up]){if(a[up]==N){cout<<a[up-1]<<" X"<<endl;} else{cout<<a[up]<<" X"<<endl;}}
        else
        {
            while(f)
            {
                if(a[mid]==N){cout<<a[mid-1]<<" "<<a[mid+1]<<endl; f = 0; break ;}
                else if(N<a[mid]&&N>a[mid-1]){cout<<a[mid-1]<<" "<<a[mid]<<endl; f = 0; break ;}
                else if(N>a[mid]&&N<a[mid+1]){cout<<a[mid]<<" "<<a[mid+1]<<endl; f = 0; break ;}
                else if(N>a[mid]){ low = mid ; mid = (low + up)/2;}
                else if(N<a[mid]){ up = mid; mid = (low+up)/2;}
            }
        }
    }
    return 0;
}

Uva – 11364 – Parking

Problem Name :  Parking

Problem Link : See Problem : Uva – 11364

Solution  :

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int a[100],t,n;
    cin>>t;
    while(t--)
    {
        cin>>n;
        int s=100000,m=0;
        for(int i=0;i<n;i++)
            cin>>a[i];
        for(int i=0;i<n;i++){
            if(a[i]<s)
            {
                s=a[i];
            }
        }
        for(int j=0;j<n;j++)
        {
            if(a[j]>m)
                m=a[j];
        }
        cout<<((m-s)*2)<<endl;
    }

    return 0;
}

Create a free website or blog at WordPress.com.

Up ↑