f1.cpp
// Fractional Lotion
// VOGEL BROTHERS
#include <cstdlib>
#include <iostream>
using namespace std;
int func (int n) {
int x,twoN, yInt, count;
bool * results = new bool[n];
for (int i = 0; i < n; i++) {
results[i] = false;
}
float yFloat;
twoN = n*2;
count = 0;
// calculate solutions
for (x = n+1; x <= twoN; x++) {
int nx, xmn; // nx = n*x, xmn = x - n
nx = n*x;
xmn = x-n;
yInt = nx / xmn;
yFloat = (float) nx / (float) xmn;
if ((float) yInt == yFloat) {
if (results[xmn-1] != true) {
results[xmn-1] = true;
count ++;
}
}
}
delete[]results;
return count;
}
int main () {
char dummy, dummy2;
char temp[10];
int n;
while (cin.getline(temp, 10)) {
n = atoi(temp+2);
// print result
cout << func(n) << endl;
}
return 0;
}