mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-30 15:36:27 +00:00
P2524 Uim的情人节礼物·其之弐
R52219323
This commit is contained in:
parent
a47b17b9fd
commit
7390c1003d
28
Luogu/problem/P2524/P2524.cpp
Normal file
28
Luogu/problem/P2524/P2524.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int n, ans, a[11], b[11];
|
||||
|
||||
bool cmp() {
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (a[i] != b[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int main() {
|
||||
scanf("%d", &n);
|
||||
for (int i = 0; i < n; i++) {
|
||||
scanf("%1d", a + i);
|
||||
b[i] = i + 1;
|
||||
}
|
||||
while (!cmp()) {
|
||||
next_permutation(b, b + n);
|
||||
ans++;
|
||||
}
|
||||
cout << ++ans << endl;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user