This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int n = 5;
long long sum = 0,total = 0;
int howmany[1000];
void rec(int now) {
if(now == n){
total++;
for (int i = 1; i <= n; i++) {
if (howmany[i] == i) {
sum++;
return;
}
}
return;
}
for (int i = 1;i <= n; i++) {
howmany[i]++;
rec(now + 1);
howmany[i]--;
}
}
int main()
{
cin >> n;
rec(0);
cout << sum << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |