Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define pb push_back
- #define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
- #define F first
- #define S second
- typedef long long ll;
- typedef vector< int > vi;
- typedef vector< ll > V;
- typedef map<int, int > mp;
- #define debug cout << -1 << endl;
- #define REP(i, a, b) for(int i=a; i<b; i++)
- #define pop pop_back
- const ll MOD = 1000000007;
- const int maxN = 2001;
- int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1};
- int dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
- void solve()
- {
- int n;
- cin >> n;
- int cnt = 0;
- if(n==2) {
- for(int a=0; a<=9; a++) {
- for(int b=0; b<=9; b++) {
- if(a==b) cnt++;
- }
- }
- }
- else if(n==4){
- for(int a=0; a<=9; a++) {
- for(int b=0; b<=9; b++) {
- for(int c=0; c<=9; c++) {
- for(int d=0; d<=9; d++) {
- if(a+b==c+d) cnt++;
- }
- }
- }
- }
- }
- else if(n==6){
- for(int a=0; a<=9; a++) {
- for(int b=0; b<=9; b++) {
- for(int c=0; c<=9; c++) {
- for(int d=0; d<=9; d++) {
- for(int e=0; e<=9; e++) {
- for(int f=0; f<=9; f++) {
- if(a+b+c==d+e+f) cnt++;
- }
- }
- }
- }
- }
- }
- }
- else if(n==8){
- for(int a=0; a<=9; a++) {
- for(int b=0; b<=9; b++) {
- for(int c=0; c<=9; c++) {
- for(int d=0; d<=9; d++) {
- for(int e=0; e<=9; e++) {
- for(int f=0; f<=9; f++) {
- for(int g=0; g<=9; g++) {
- for(int h=0; h<=9; h++) {
- if(a+b+c+d==e+f+g+h) cnt++;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- cout << cnt << endl;
- return;
- }
- int main()
- {
- FastIO;
- int t;
- t = 1;
- //cin >> t;
- while(t--){
- solve();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement