138

Street Numbers
Type: Number Theory  
Diff: 5.0

Tricks

When I read this problem, I could not be able to find out what this problem meant. Then I visit the Steven Halim's Websites and found the following information.

This problem is actually simple. What the problem wants us to do is:

1,2,3,4,5,6,7,8
Your house number = 6
When you walk to the left to the end of the street (always until you encounter 1 - The leftmost house), you sum their numbers�. 5 + 4 + 3 + 2 + 1 = 15. Then you walk to the right and do the same thing, 7+8=15
You found out that both values are the same. Output 6 (Your house number), and 8 (The rightmost house number matching this criteria)

To do this, calculate "Sum of left" and "Sum of right", using Arithmetic Progression formula
Then use precalc (Pre Calculation)

For more details visit http://www.comp.nus.edu.sg/~stevenha/programming/acmoj.html

If you have any advice, complements 

or proposal, please  Send mail to Author

Submit

 

1