Notes
for nemo
Pages
Home
C / Linux
Data Structures & Algorithms
UVa Problems
Interview Problems
More
Monday, April 8, 2013
10783 - Odd Sum
Using the comments:
b=a+(n-1)d (arithmetic series)
sn=n/2[2a + (n-1)d]
sum = (n * (
2
*a + (n-
1
)*d))/
2
; had a wrong answer when I tried to divide n/2 first. if n=1 then n/2 = 0 (flooring).
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)

## No comments:

## Post a Comment