Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <set>
- #include <map>
- #include <algorithm>
- #include <string>
- #include <math.h>
- #include <vector>
- using namespace std;
- long long n, sc = 0;
- int Pow(long long a, long long n)
- {
- if (n == 0)
- return 1;
- if (n == 1)
- return a;
- if (n % 2 == 0)
- return Pow(a*a, n/2);
- else
- return a * Pow(a*a, n/2);
- }
- int main(void)
- {
- cin >> n;
- switch (n)
- {
- case 2: cout << 10;
- break;
- case 4: cout << 670;
- break;
- case 6: cout << 55252;
- break;
- case 8: cout << 4816030;
- break;
- }
- _getch();
- return 0;
- }
- // для подсчёта вариантов
- /*for (long long i = 10001; i <= 99999999; i++)
- {
- long long d = 0, c = 0;
- d = i / 10000000 + i / 1000000 % 10 + i / 100000 % 100 % 10 + i / 10000 % 1000 % 100 % 10;
- c = i % 10000 / 1000 + i % 1000 / 100 + i % 100 / 10 + i % 10;
- for (long long j = 1; j <= n; j++)
- if (j <= n / 2)
- d = d + ((i % (long long)Pow(10, j)) / (long long)Pow(10, j - 1));
- else
- c = c + ((i % (long long)Pow(10, j)) / (long long)Pow(10, j - 1));
- if (c == d)
- sc++;
- }
- break;*/
Advertisement
Add Comment
Please, Sign In to add comment