HackIM 2013 - Programming 300 WriteUp | APU CSFC


Posted: 2013-03-02 05:00   |  More posts about CTF nullcon HackIM WriteUps

Programming 3 - 300 points

Description: So our folks wanted to work on binomial series but they understood incorrectly so they made a series of this type. if series is for 10 numbers

10/1 + 9/2 + 8/3 ..... 1/10 = 22.218
round to 2 decimal place = 22.21

now they did calculated this series for 31337 numbers can you help these guys in finding the number again.

public class Binomial {
    static final int number=31337; // The binominal value that we are searching for based on the requirements.
    /** * @param args the command line arguments */
    public static void main(String[] args) {
        // TODO code application logic here
        double sum=0; // sum is declared and initialised with the value of zero.
        for(int ctr=1;ctr<=number;ctr++)
        {
            sum=sum+(((number+1)-ctr)/ctr);  // The method of calculation used.
    // e.g.  Term 1: sum=0+(((31337+1)-1)/1),
    // Term 2: sum=31337+(((31337+1)-2)/2), ...,
    //Term 31337: sum=311180.64640351594+(((31337+1)-31337)/31337)
        }
        System.out.printf("%.2f\n",sum); // Round off to two decimal places.
    }
}

The flag is: 311180.65

Contents © 2013 admin - Powered by Nikola