Google Code Jam Qualification Round Africa 2010 (Problem A. Store Credit)







#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int t,v,a[10000],i,j,sum,n,k,l,u,m,c;
    ifstream in ("input.txt");
    ofstream out ("output.txt");
    in>>t;
    for(i=1;i<=t;i++)
    {
        in>>v>>n;
        c=0;
        for(m=1;m<=n;m++)
        {
            in>>a[m];
        }
        for(j=1;j<=n;j++)
        {
            for(k=j+1;k<=n;k++)
            {
                if(a[j]+a[k]==v)
                {
                    l=j;
                    u=k;
                    break;
                }

            }

        }
        out<<"Case #"<<i<<":"<<" "<<l<<" "<<u<<endl;
    }
    return 0;
}

Download Coding Interview Book and Get More Tutorials for Coding and Interview Solution: Click Here

Download System Design Interview Book and Get More Tutorials and Interview Solution: Click Here

Do you need more Guidance or Help? Then Book 1:1 Quick Call with Me: Click Here

Share on Google Plus

About Ashadullah Shawon

I am Ashadullah Shawon. I am a Software Engineer. I studied Computer Science and Engineering (CSE) at RUET. I Like To Share Knowledge. Learn More: Click Here
    Blogger Comment
    Facebook Comment

2 comments:

  1. A small, light and portable wireless credit card machine is one of those wonderful inventions which make business interaction of today so comfortable for both buyers and sellers. Needless to say, if your business is not static and requires mobility, such item is one of the most essential things for your company to have. Free Credit Card Processing

    ReplyDelete
  2. A small, light and portable wireless credit card machine is one of those wonderful inventions which make business interaction of today so comfortable for both buyers and sellers. Needless to say, if your business is not static and requires mobility, such item is one of the most essential things for your company to have. Tellthebell

    ReplyDelete