solution.cpp 1.0 KB
Newer Older
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
#include <iostream>
using namespace std;

int main()
{
    int ans = 0;
    for (int a = 1; a < 10; a++)
    {
        for (int b = 1; b < 10; b++)
        {
            if (b != a)
                for (int c = 1; c < 10; c++)
                {
                    if (c != b && c != a)
                        for (int d = 1; d < 10; d++)
                        {
                            if (d != c && d != b && d != a)
                                for (int e = 1; e < 10; e++)
                                {
                                    if (e != d && e != c && e != b && e != a)
                                    {
                                        //	ab*cde=adb*ce;
                                        if ((a * 10 + b) * (c * 100 + d * 10 + e) == (a * 100 + d * 10 + b) * (c * 10 + e))
                                            ans++;
                                    }
                                }
                        }
                }
        }
    }
    cout << ans << endl;
    return 0;
}