1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

vector < int > dividers( int n )
{
    vector < int > result;
    for ( int i = 1; i*i <= n; ++i )
    {
        if ( n % i == 0 )
        {
            result.push_back( i );
            if ( i * i != n ) result.push_back( n / i );
        }
    }
    return result;
}

int main()
{
    int n, a, b, c;
    long long answer;
    vector < int > div, div2;

    //while ( true )
    {
        answer = 0;
        scanf( "%d", &n );

        div = dividers( n );

        for ( int i = 0; i < div.size(); ++i )
        {
            a = div[i];
            div2 = dividers( n - a );
            for ( int j = 0; j < div2.size(); ++j )
            {
                b = div2[j];
                c = n - a - b;
                if ( c % a == 0 && c % b == 0 &&  a < b && b < c )
                {
                    answer++;
                }
            }
        }
        printf( "%lld\n", answer );
    }
}