Codechef June Challenge

Complete : Chef and Subarray
Screenshot from 2014-06-07 09:57:11

Complete : Guessing Game

Screenshot from 2014-06-07 10:47:29


4 thoughts on “Codechef June Challenge

  1. I presume that you are using brute force method for finding the Irreducible fraction, so I stress this link. Read on and I am promising that you will find a faster algorithm to find the irreducible fraction.
    If not, i think you are correct. Try after some time.
    I am struggling too hard for third one 😦


  2. now thanks to gcd function I dont get that error still it says incorrent. The thing is I feel there is something worng with type of i/o that my program gives. Can you please check the code and tell if its a logical fault or fault with my i/o (if it is with i/o please tell the correct way)…


    using namespace std;
    unsigned int hcf(unsigned long a, unsigned long b) {
    if (b == 0) {
    return a;
    } else {
    return hcf(b, a % b);
    int main()
    // freopen(“out.txt”,”w”,stdout);
    // freopen(“in.txt”,”r”,stdin);
    unsigned long T,N[100000],M[100000],i,j,no,ne,mo,me,n1,n2,k;
    no = ne = N[i]/2;
    if(N[i]%2!=0) no++;
    mo = me = M[i]/2;
    if(M[i]%2!=0) mo++;
    n1 = ne*mo + no*me;
    n2 = N[i]*M[i];
    k = hcf(n1,n2);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s