sumi1234's Profile User Rating: -----

Reputation: 0 Apprentice
Active Posts:
30 (0.03 per day)
07-November 11
Profile Views:
Last Active:
User is offline Aug 26 2013 11:50 AM

Previous Fields

Dream Kudos:
Icon   sumi1234 has not set their status

Posts I've Made

  1. In Topic: Getting segmentation fault in code to find a^b mod m on spoj

    Posted 25 Aug 2013

    View Postjimblumberg, on 25 August 2013 - 01:52 PM, said:

    Please explain the following line:

            b[260] = {0};

    There are a couple of things wrong but you need to tell me what you're trying to do before I can offer suggestions on a fix.


    I was just checking to see if reinitialising the array to 0 might work. As I was getting a seg fault.

    Basically, I am reading in t, which is the number of test cases.

    For each test case , I take as input 3 numbers a , b and m where a and m are in base 10 and b is in base 3

    I print a^b mod m for each test case

    I have inputted b in the form of a c string .

    convert function converts the c string b into bint in base 10.

    calc function calculates (a^b-1 mod m)*a mod m.

    so for the final result i do result%m again.

    (ab) mod m = ((a mod m)*(b mod m))mod m

    P.S. try using the ideone link. There was some problem while copy pasting so weird symbols like > are there in the program
  2. In Topic: Getting segmentation fault in code to find a^b mod m on spoj

    Posted 25 Aug 2013

    View Postjimblumberg, on 25 August 2013 - 01:21 PM, said:

    I don't know how it is working at all. I get the following error when I try to compile your code:


    main.c||In function ‘convert’:|
    main.c|20|error: comparison between pointer and integer|


    Sorry about that.. try this one
    long long calc(long a,long long b,long int m)
        long long temp;
            return 1%m;
        temp = calc(a%m,(b>>1),m);
        if(b%2 == 0)
            return (temp*temp)%m;
            return ((a%m)*temp*temp);
    long long convert(char arr[])
        int i =0 ;
        long long result = 0;
        for (i=0;arr[i] != '\0';i++)
            result = result*3 + (arr[i] - '0');
        return result;
    int main()
        long int t,i,m;
        long long bint;
        long int a;//base 10
        char b[260];
        //char *endptr;
            bint = convert(B)/>;
            b[260] = {0};
            else if(bint == 1)
        return 0;

    Here is the ideone link for the same
  3. In Topic: First J2ee project

    Posted 30 Oct 2012

    View PostfromTheSprawl, on 29 October 2012 - 07:32 PM, said:

    Additional thoughts for you:
    1. Have you considered what server to use? Your J2EE project will not run without a server you know.
    2. Are you considering buying for proprietary software to run this thing(database, libraries) or are you planning to go the freeware way?
    3. I'm sure there'll be some reports generation that will happen on your system. Have you decided what reports library to use?
    4. Last of all, I'm just throwing this out there, but look into using frameworks like Spring and Hibernate. You can add this to your experience.

    Good luck!

    Greatly informative reply .
    1. Well most probably gonna use tomcat apache or apache server
    2. The database is gonna be sql server (We are getting it for free as i am a student :)) or mysql

    I have another question : a friend if mine said that if we have to deploy it on a LAN , how about making the web app using php and mysql as it will take less time. Thought??

My Information

Member Title:
New D.I.C Head
Age Unknown
Birthday Unknown

Contact Information

Click here to e-mail me


sumi1234 hasn't added any friends yet.


sumi1234 has no profile comments yet. Why not say hello?