Algorithm for placing plus and minus signs between digits so that the result is 100

Yesterday I found the following programming problem:
Write a program that outputs all possibilities to put + or – or nothing between the numbers 1,2,…,9 (in this order) such that the result is 100.

This problem has 11 solutions and they are demonstrated here: Fun with numbers: place plus/minus signs between the digits.
1 + 2 + 34 – 5 + 67 – 8 + 9 = 100
12 + 3 – 4 + 5 + 67 + 8 + 9 = 100
123 – 4 – 5 – 6 – 7 + 8 – 9 = 100
123 + 4 – 5 + 67 – 89 = 100
123 + 45 – 67 + 8 – 9 = 100
123 – 45 – 67 + 89 = 100
12 – 3 – 4 + 5 – 6 + 7 + 89 = 100
12 + 3 + 4 + 5 – 6 – 7 + 89 = 100
1 + 23 – 4 + 5 + 6 + 78 – 9 = 100
1 + 23 – 4 + 56 + 7 + 8 + 9 = 100
1 + 2 + 3 – 4 + 5 + 6 + 78 + 9 = 100

But the page in the link provides only answers without an algorithm, that’s why I decided to write it myself.
Read more of this post

Advertisements

How I use Google Analytics for Mobile Apps

Google Analytics is a service that collects information about web site visits and then displays it in the form of charts and tables. In this post I will enumerate reports and pages that I use for my Android application.

Visits by country

It is the main report and it can be seen by using Audience->Geo->Location. It will display the countries on the map as well as in the table.
Also if you click on any country in the list, it will display the list of areas (or states) and the list of cities.
visits_location
It is very similar to the Google Play statistics which shows installs by country:
installs_country
But Google Analytics has more data and shows real usage instead of one-time installs.
Read more of this post