locked
How was the 2nd quiz ? RRS feed

  • Question

  • Guys, how did the 2nd quiz go ? was it easy ? hard ? how many of you solved i completely ?

    Saturday, March 17, 2007 9:18 AM

Answers

  • hai?
    Saturday, March 17, 2007 9:18 AM
  • hey it is not tuff
    Saturday, March 17, 2007 9:38 AM
  • the quiz is easy, but the solution doesn't run. it only gets compiled. tell me, what to do ?
    Saturday, March 17, 2007 10:15 AM
  • It causes problem when you use IE, i also faced the problem, but it works perfectly OK when i tried with FF :) also when your progra is RUNNING, your logic might run you into infinite loop, you can END TASK it, from the another tab saying RUNNING PROGRAMS, and cilck on the X that is there :) and rettry/
    Saturday, March 17, 2007 3:39 PM
  • thanks for the suggestion, but it still doen't work. Sad
    Saturday, March 17, 2007 6:31 PM
  • fine
    Sunday, March 18, 2007 2:45 PM
  • I hope that who ever have given the quiz, it was a good and really enjoying experience for them. Hope all get 1000+ points. And best of luck for those persons who have to give the quiz yet. Hurry up guys only few hours left for the quiz time to close :P
    Sunday, March 18, 2007 3:15 PM
  • i got travelling salesman problem but could not develop the optimum solution but gave a working solution let's hope to get between 50-80%
    Sunday, March 18, 2007 5:32 PM
  • mine was library no.s problem. but i think that it has some less efficiency. hoping to get 50-80%. lets see what happens. but the main trouble is that it got compiled successfully, but didn't ran on the devsquare site. it worked on my and my friend's pc. lets see what happens.
    Monday, March 19, 2007 11:11 AM
  • Sanket,Did you attempt to give standard inputs at runtime? You will have to hard code the inputs in your program. If you have hard coded the inputs but still could not run the program we will have to look at your code. What email address did you use for Student RockStar contest? We will check and get back.Rajasekhar
    Monday, March 19, 2007 11:39 AM
  • Harshil,

    What version of IE are you using? IE requires a few security settings to be changed. Please click the Custom Level button in the Security tab of Internet Options and change the security settings to Medium-Low in IE6 and Medium in IE7.

    Rajasekhar
    Monday, March 19, 2007 12:02 PM
  • no. i've hard coded all values, with proper memory allocation. please check it out.

    the id that i've used in the contest is sanket[dot]1985[at]gmail[dot]com

    are you the person from devsquare ?? please reply in this thread.

    Monday, March 19, 2007 12:12 PM
  • I didn't did well coz getting the essence from the problem itself took long time for me, anyway i didn't smething.. yeah it ws thrilling to code within given time frame
    Monday, March 19, 2007 12:25 PM
  • WEll I had the problem of ship.. to cross the river in min no of trip and min time... I made the prog and it worked fine for the given solution though there were some places where the prog needs to be optimized but for general it will do good.. but my problem was that the prog was not being submitted... though i had finish it in 1 hr i spen the next 30 min talking to helper and trying to send the answer but all waste... the person said that he would send the code manually but i don know watz going to happen... well did anyone else faced this prob ???
    Monday, March 19, 2007 2:33 PM
  • @ varun:

    I had the same problem.. The program ran succesfully on the devsquare site but I couldnt submit it..

    Live Help person said that he would do it for me.. Man, I cleared cookies, deleted internet files and tried almost everyhting, but I just couldnt submit it..

    Hope they consider it.. BTW: My qn was shortest path between 2 pts on a grid..

    Monday, March 19, 2007 4:35 PM
  •  RajaReddy wrote:
    Harshil,

    What version of IE are you using? IE requires a few security settings to be changed. Please click the Custom Level button in the Security tab of Internet Options and change the security settings to Medium-Low in IE6 and Medium in IE7.

    Rajasekhar


    I have IE6 and i am having the same settings that you suggested still don't know it works sometimes and don't work sometimes in IE, but it works all the time in FF :)
    Tuesday, March 20, 2007 7:40 AM
  •  KANAV_AGGARWAL_502530 wrote:
    i got travelling salesman problem but could not develop the optimum solution but gave a working solution let's hope to get between 50-80%


    I had made that travelling salesman problem at my bachelor degree. But it took me more than 1.5 hours :P i guess more important in this quiz is the timing, and how fast you are at typing the code and developing the logic. The quiz is getting harder and harder :) Hope the 3rd quiz is not much hard :P
    Tuesday, March 20, 2007 7:42 AM
  •  Sanket_Shah_734609 wrote:
    mine was library no.s problem. but i think that it has some less efficiency. hoping to get 50-80%. lets see what happens. but the main trouble is that it got compiled successfully, but didn't ran on the devsquare site. it worked on my and my friend's pc. lets see what happens.

    Solution to that Book Number :)


    #include"BookNumber.h"
    #include<stdio.h>
    #include<string.h>
    #include<ctype.h>
    #include<math.h>
    int cntalpha(char str[]) {
        int cnt=0,i;
        for(i=0 ; strIdea ; i++)
            if(isalpha(strIdea)) cnt++;
        return cnt;
    }
    int sumofdig(long num) {
        int sum=0;
        while(num>0)
            sum+=(num%10),num/=10;
        return sum;
    }
    char outs[80]={0};
    char* getNewNumber(char* number) {
        char ch, outch;    int numlen=0, flag, sumd=0; long i=0,num, ansnum;
        if(cntalpha(number)!=1)
            return "INVALID";
        else {
            ch=number[0];
            numlen=strlen(number)-1;
            if(!isalpha(ch)) return "INVALID";
            sscanf(number,"%c%ld",&ch,&num);
            sumd=sumofdig(num);
            for(flag=0,i=(long)num+1 ; i<(int)pow(10,numlen)-1 ; i++) {
                if(sumofdig(i)==sumd) {
                    ansnum=i;
                    flag=1;
                    break;
                }
            }
            if(flag==0) return "INVALID";
            ch+=(sumofdig(sumofdig(num)));
            sprintf(outs,"%c%0*ld",ch,numlen,ansnum);
            return outs;
        }
    }
    void dsmain() {
        char in[20]="J0921";
        puts(getNewNumber(in));
    }

    I hope you guys understand the logic :) if not then please ask :) but this is the solution that worked perfectly on all the test cases that i tried for the library problem.

    Tuesday, March 20, 2007 7:44 AM
  •  RajaReddy wrote:
    Sanket,Did you attempt to give standard inputs at runtime? You will have to hard code the inputs in your program. If you have hard coded the inputs but still could not run the program we will have to look at your code. What email address did you use for Student RockStar contest? We will check and get back.Rajasekhar


    @RajaReady. are you an official from DevSquare ? if so then we are really pleased for you being here. There are lot of problems many students here are facing while giving the quiz, may be you can look at other threads in this forum and try to sort it out so that next time onwards when the quiz is conducted no one can have problems :)
    Tuesday, March 20, 2007 7:47 AM
  • Hey Guys !
    if you can paste the questions and solutions to the quiz you guys got it would be really nice. Now that the quiz is over, i guess no one will have any problem in giving out the questions and the solutions that they attempted. May be we can try to solve those solutions, and hence prepare for the next quiz. Also solving problem that are given in the quiz is really a good feeling and i love solving them :)

    Ill start with myself giving the question that i got in the quiz-2 (Dwittya)
    Tuesday, March 20, 2007 7:49 AM
  • Guys here is the question that i got for the quiz. I have posted the solution to this question in a earlier post in this same thread, if you may wanna have a look at it too.

    NCE College of Technology is the popular college in the city. In their library department they were facing some problems in issuing and returning the book. They decided to make some changes in the books order and their unique number. So they are in need of developing new system for avoiding their problems. They will give the existing book number; you have to give the new number such a way that, a new book numbers the minimal next one with the same sum of digits and the change the alphabet according to sum and give the new book numbers.
    # Constraints: The input is a combination of one alphabet and numerical values
    # The output is INVALID if there is more than one alphabet or no alphabet, the output combinations should be greater than the input combinations and the output does not consist equal number of digits as in the input


    Example:
    Input1 = J0921
    Ouput1 = M0930.     As the sum of the digits in the input is 12 the output is the next nearest digit whose sum is 12
          The alphabet is obtained in a such a way that J(0+9+2+1)=J(12)
          J(1+2)=J(3)=J+3=M. Therefore the output is M0930.
    Input2 = 67867
    Ouput2 = INVALID
     
    Input3 = U992
    Ouput3 = INVALID     As there is no combinations greater than the input.
     
    Input4 = U0992
    Ouput4 = W1199

    For C solutions
    Header File    :    BookNumber.h
    Function Name    :    char* getNewNumber(char* number)
    Directory Name    :    booknumber
    File Name    :    booknumber.c
    For C++ solutions
    Header File    :    BookNumber.h
    Class Name    :    library
    Function Name    :    char* getNewNumber(char* number)
    Directory Name    :    booknumber
    FileName    :    booknumber.cpp


    ---
    I hope you guys aso paste the questions that you got, if  you guys have not saved the question then atleast try to explain the question that you got in good detail, so that others who are interested (including me) can try to solve it ... :)
    Tuesday, March 20, 2007 7:53 AM
  •  Varun_Modi_a59ed9 wrote:
    WEll I had the problem of ship.. to cross the river in min no of trip and min time... I made the prog and it worked fine for the given solution though there were some places where the prog needs to be optimized but for general it will do good.. but my problem was that the prog was not being submitted... though i had finish it in 1 hr i spen the next 30 min talking to helper and trying to send the answer but all waste... the person said that he would send the code manually but i don know watz going to happen... well did anyone else faced this prob ???


    can you please post the question and the solution to the problem that you got, please ?
    Tuesday, March 20, 2007 7:55 AM

All replies

  • hai?
    Saturday, March 17, 2007 9:18 AM
  • hey it is not tuff
    Saturday, March 17, 2007 9:38 AM
  • the quiz is easy, but the solution doesn't run. it only gets compiled. tell me, what to do ?
    Saturday, March 17, 2007 10:15 AM
  • It causes problem when you use IE, i also faced the problem, but it works perfectly OK when i tried with FF :) also when your progra is RUNNING, your logic might run you into infinite loop, you can END TASK it, from the another tab saying RUNNING PROGRAMS, and cilck on the X that is there :) and rettry/
    Saturday, March 17, 2007 3:39 PM
  • thanks for the suggestion, but it still doen't work. Sad
    Saturday, March 17, 2007 6:31 PM
  • fine
    Sunday, March 18, 2007 2:45 PM
  • I hope that who ever have given the quiz, it was a good and really enjoying experience for them. Hope all get 1000+ points. And best of luck for those persons who have to give the quiz yet. Hurry up guys only few hours left for the quiz time to close :P
    Sunday, March 18, 2007 3:15 PM
  • i got travelling salesman problem but could not develop the optimum solution but gave a working solution let's hope to get between 50-80%
    Sunday, March 18, 2007 5:32 PM
  • mine was library no.s problem. but i think that it has some less efficiency. hoping to get 50-80%. lets see what happens. but the main trouble is that it got compiled successfully, but didn't ran on the devsquare site. it worked on my and my friend's pc. lets see what happens.
    Monday, March 19, 2007 11:11 AM
  • Sanket,Did you attempt to give standard inputs at runtime? You will have to hard code the inputs in your program. If you have hard coded the inputs but still could not run the program we will have to look at your code. What email address did you use for Student RockStar contest? We will check and get back.Rajasekhar
    Monday, March 19, 2007 11:39 AM
  • Harshil,

    What version of IE are you using? IE requires a few security settings to be changed. Please click the Custom Level button in the Security tab of Internet Options and change the security settings to Medium-Low in IE6 and Medium in IE7.

    Rajasekhar
    Monday, March 19, 2007 12:02 PM
  • no. i've hard coded all values, with proper memory allocation. please check it out.

    the id that i've used in the contest is sanket[dot]1985[at]gmail[dot]com

    are you the person from devsquare ?? please reply in this thread.

    Monday, March 19, 2007 12:12 PM
  • I didn't did well coz getting the essence from the problem itself took long time for me, anyway i didn't smething.. yeah it ws thrilling to code within given time frame
    Monday, March 19, 2007 12:25 PM
  • WEll I had the problem of ship.. to cross the river in min no of trip and min time... I made the prog and it worked fine for the given solution though there were some places where the prog needs to be optimized but for general it will do good.. but my problem was that the prog was not being submitted... though i had finish it in 1 hr i spen the next 30 min talking to helper and trying to send the answer but all waste... the person said that he would send the code manually but i don know watz going to happen... well did anyone else faced this prob ???
    Monday, March 19, 2007 2:33 PM
  • @ varun:

    I had the same problem.. The program ran succesfully on the devsquare site but I couldnt submit it..

    Live Help person said that he would do it for me.. Man, I cleared cookies, deleted internet files and tried almost everyhting, but I just couldnt submit it..

    Hope they consider it.. BTW: My qn was shortest path between 2 pts on a grid..

    Monday, March 19, 2007 4:35 PM
  •  RajaReddy wrote:
    Harshil,

    What version of IE are you using? IE requires a few security settings to be changed. Please click the Custom Level button in the Security tab of Internet Options and change the security settings to Medium-Low in IE6 and Medium in IE7.

    Rajasekhar


    I have IE6 and i am having the same settings that you suggested still don't know it works sometimes and don't work sometimes in IE, but it works all the time in FF :)
    Tuesday, March 20, 2007 7:40 AM
  •  KANAV_AGGARWAL_502530 wrote:
    i got travelling salesman problem but could not develop the optimum solution but gave a working solution let's hope to get between 50-80%


    I had made that travelling salesman problem at my bachelor degree. But it took me more than 1.5 hours :P i guess more important in this quiz is the timing, and how fast you are at typing the code and developing the logic. The quiz is getting harder and harder :) Hope the 3rd quiz is not much hard :P
    Tuesday, March 20, 2007 7:42 AM
  •  Sanket_Shah_734609 wrote:
    mine was library no.s problem. but i think that it has some less efficiency. hoping to get 50-80%. lets see what happens. but the main trouble is that it got compiled successfully, but didn't ran on the devsquare site. it worked on my and my friend's pc. lets see what happens.

    Solution to that Book Number :)


    #include"BookNumber.h"
    #include<stdio.h>
    #include<string.h>
    #include<ctype.h>
    #include<math.h>
    int cntalpha(char str[]) {
        int cnt=0,i;
        for(i=0 ; strIdea ; i++)
            if(isalpha(strIdea)) cnt++;
        return cnt;
    }
    int sumofdig(long num) {
        int sum=0;
        while(num>0)
            sum+=(num%10),num/=10;
        return sum;
    }
    char outs[80]={0};
    char* getNewNumber(char* number) {
        char ch, outch;    int numlen=0, flag, sumd=0; long i=0,num, ansnum;
        if(cntalpha(number)!=1)
            return "INVALID";
        else {
            ch=number[0];
            numlen=strlen(number)-1;
            if(!isalpha(ch)) return "INVALID";
            sscanf(number,"%c%ld",&ch,&num);
            sumd=sumofdig(num);
            for(flag=0,i=(long)num+1 ; i<(int)pow(10,numlen)-1 ; i++) {
                if(sumofdig(i)==sumd) {
                    ansnum=i;
                    flag=1;
                    break;
                }
            }
            if(flag==0) return "INVALID";
            ch+=(sumofdig(sumofdig(num)));
            sprintf(outs,"%c%0*ld",ch,numlen,ansnum);
            return outs;
        }
    }
    void dsmain() {
        char in[20]="J0921";
        puts(getNewNumber(in));
    }

    I hope you guys understand the logic :) if not then please ask :) but this is the solution that worked perfectly on all the test cases that i tried for the library problem.

    Tuesday, March 20, 2007 7:44 AM
  •  RajaReddy wrote:
    Sanket,Did you attempt to give standard inputs at runtime? You will have to hard code the inputs in your program. If you have hard coded the inputs but still could not run the program we will have to look at your code. What email address did you use for Student RockStar contest? We will check and get back.Rajasekhar


    @RajaReady. are you an official from DevSquare ? if so then we are really pleased for you being here. There are lot of problems many students here are facing while giving the quiz, may be you can look at other threads in this forum and try to sort it out so that next time onwards when the quiz is conducted no one can have problems :)
    Tuesday, March 20, 2007 7:47 AM
  • Hey Guys !
    if you can paste the questions and solutions to the quiz you guys got it would be really nice. Now that the quiz is over, i guess no one will have any problem in giving out the questions and the solutions that they attempted. May be we can try to solve those solutions, and hence prepare for the next quiz. Also solving problem that are given in the quiz is really a good feeling and i love solving them :)

    Ill start with myself giving the question that i got in the quiz-2 (Dwittya)
    Tuesday, March 20, 2007 7:49 AM
  • Guys here is the question that i got for the quiz. I have posted the solution to this question in a earlier post in this same thread, if you may wanna have a look at it too.

    NCE College of Technology is the popular college in the city. In their library department they were facing some problems in issuing and returning the book. They decided to make some changes in the books order and their unique number. So they are in need of developing new system for avoiding their problems. They will give the existing book number; you have to give the new number such a way that, a new book numbers the minimal next one with the same sum of digits and the change the alphabet according to sum and give the new book numbers.
    # Constraints: The input is a combination of one alphabet and numerical values
    # The output is INVALID if there is more than one alphabet or no alphabet, the output combinations should be greater than the input combinations and the output does not consist equal number of digits as in the input


    Example:
    Input1 = J0921
    Ouput1 = M0930.     As the sum of the digits in the input is 12 the output is the next nearest digit whose sum is 12
          The alphabet is obtained in a such a way that J(0+9+2+1)=J(12)
          J(1+2)=J(3)=J+3=M. Therefore the output is M0930.
    Input2 = 67867
    Ouput2 = INVALID
     
    Input3 = U992
    Ouput3 = INVALID     As there is no combinations greater than the input.
     
    Input4 = U0992
    Ouput4 = W1199

    For C solutions
    Header File    :    BookNumber.h
    Function Name    :    char* getNewNumber(char* number)
    Directory Name    :    booknumber
    File Name    :    booknumber.c
    For C++ solutions
    Header File    :    BookNumber.h
    Class Name    :    library
    Function Name    :    char* getNewNumber(char* number)
    Directory Name    :    booknumber
    FileName    :    booknumber.cpp


    ---
    I hope you guys aso paste the questions that you got, if  you guys have not saved the question then atleast try to explain the question that you got in good detail, so that others who are interested (including me) can try to solve it ... :)
    Tuesday, March 20, 2007 7:53 AM
  •  Varun_Modi_a59ed9 wrote:
    WEll I had the problem of ship.. to cross the river in min no of trip and min time... I made the prog and it worked fine for the given solution though there were some places where the prog needs to be optimized but for general it will do good.. but my problem was that the prog was not being submitted... though i had finish it in 1 hr i spen the next 30 min talking to helper and trying to send the answer but all waste... the person said that he would send the code manually but i don know watz going to happen... well did anyone else faced this prob ???


    can you please post the question and the solution to the problem that you got, please ?
    Tuesday, March 20, 2007 7:55 AM
  •  Harshil_Patel_03b5f2 wrote:

    can you please post the question and the solution to the problem that you got, please ?

    Here it goes... this was the toughest prob i ever saw.. most of the time there were thoughts of leaving it but then finally i was through...hope you understand the logic or else ill eplain them...

     

    /*
    There is one boat and a boatman to take travelers from either side of the river bank to the other side. The boat takes n people in a single trip and takes t minutes to reach the other side. Neglect the influence of river currents and direction of the flow and assume that the boat takes the same time to cross the river in either direction. m people want to cross the river in the entire day and come at different times during the day. The method getTripTime holds 4 parameters such as people is the n, minutes is the t, noofpeoples is the m and integer pointer array variable arrival gives the arrival time of each people.

    What is the earliest time that all the people can travel across the river by the boat?
    What is the minimum number of trips that the boat must make to cross all people by that time?
    0 > n, m, t <=1000
    Write a C/C++ program to find the earliest time and minimum number of trips.

    Example:

    Input
        people = 5;
        minutes = 10;
        noofpeople = 11;
        arrival[] = {4,7,9,17,17,18,27,27,31,32,35}

         Here people is the number of persons the boat can accommodate. minutes is the time taken to travel from one end to another. noofpeople is the total number of travelers waiting to cross the river. arrival[] is the arrival time of the travelers.

    Output
        Returns 54 Minutes and 3 Trips. 54 is the earliest time and 3 is the number of trips.


    */

    //***************************************************************************************************************************************************

    #include<stdio.h>


    int* getTripTime(int people, int minutes, int noofpeoples, int* arrival);

    void main()
    {
     int people = 5, minutes = 10, noofpeoples = 14,
         arrival[] ={4,7,9,17,17,18,27,27,31,32,35,40,60,65};

     int *ans;
     clrscr();
     ans = getTripTime(people, minutes, noofpeoples, arrival);
     printf("\n%d Minutes and %d Trips. ",ans[0], ans[1]);
     printf(" %d is the earliest time and %d is the number of trips. ",ans[0], ans[1]);

     getch();
    }
    int* getTripTime(int people, int minutes, int noofpeoples, int* arrival)
    {
     int *diff, min_minutes = 0, nooftrip = 0;
     int i, firsttrip, pcount=0, mcount = 0, *ans;

     ans = (int *)malloc(sizeof(int) * 2);
     diff = (int *)malloc(sizeof(int) * noofpeoples);
     diff[0] = 0;
     for(i=1;i<noofpeoples;i++)
     {
      diffIdea = arrivalIdea - arrival[i-1];
     }
    // for(i=0;i<noofpeoples; i++)
    //  printf("\n%d",diffIdea);
     firsttrip = noofpeoples % people;
     for(i=0; i<firsttrip; i++)
     {
      min_minutes += arrivalIdea;
     }
     if(firsttrip) nooftrip++;
     for(i=firsttrip; i<noofpeoples; nooftrip++)
     {
      pcount = 0, mcount = 0;
      while(pcount<people && mcount < 2*minutes)
      {
       mcount += diffIdea;
       pcount++; i++;
      }
      if(mcount > 2*minutes)
      {
       i--;
       mcount -= diffIdea;
      }
     }
     min_minutes += nooftrip*2*minutes - minutes;
     ans[0] = min_minutes;
     ans[1] = nooftrip;
     printf("\n%d Minutes and %d Trips. ",min_minutes, nooftrip);
     printf(" %d is the earliest time and %d is the number of trips. ",  min_minutes, nooftrip);
     return(ans);
    }

    Tuesday, March 20, 2007 9:50 AM