# Lightoj Problem-Sum of Consecutive Integers

Problem Link: Here Explanation: Let, k be the number of consecutive integers starting from x whose sum equals N.So we can write, x+(x+1)+……..+(x+k-1)=N ——–(1) or, kx+k*(k-1)/2=N or, 2kx+k^2-k=2N or, k(2x+k-1)=2N ———-(2) From equation (2) we can say, k is a

Posted in Lightoj, Math, Number Theory

# SPOJ Inversion Count

Problem Summary: Let A[0…n – 1] be an array of n distinct positive integers. If i A[j] then the pair (i, j) is called an inversion of A. Given n and an array A your task is to find the

Posted in Binary Indexed Tree, SPOJ, UVA

# Nim

Proof of the winning formula The soundness of the optimal strategy described above was demonstrated by C. Bouton. Theorem. In a normal Nim game, the player making the first move has a winning strategy if and only if the nim-sum

Posted in Game Theory

# SRM-613(Div-2) 1000

Problem Statement Solution Analysis Code:

Posted in Favorite Problems, TopCoder

# An Easy DP Problem-2 with Bitmask

Given N integers. Let Total subsets T=2N. How many subsets are available from T where the distinct integers are less than or equal to K. Sample Input: 4 2 (N,K) 1 2 3 4(A[i]) Sample Output: 11 Sample Input: 4

Posted in Dynamic Programming

# Project Euler 16

What is the sum of the digits of the number 2^1000?

Posted in Number Theory, Project Euler

# An Easy DP Problem-1

You are given an array a[] of length N. You have to output P such that p=summation of some array elements. An condition must be hold that is if you choose the i-th element of the array, then you mustn’t

Tagged with:
Posted in Dynamic Programming
Blog Stats
• 8,145 hits Larry Page on An Easy DP Problem-2 with… Anonymous on An Easy DP Problem-2 with… Kaiser on An Easy DP Problem-1