// // Second homework of Algorithm Designing and Analyzing in spring semester, 2020 // // Author: // Yihang Bao // 2018011890 // Created by Yihang Bao on 2020/3/11. // // #include<bits/stdc++.h> #define INF 0x3f3f3f3 #define maxn 100100 typedeflonglong ll; usingnamespacestd; #define rep(i, n, args...) for (ll i = 0, ##args; i < n; i++) #define repr(i, s, e, args...) for (ll i = s, ##args; i < e; i++) #define erg(i, u, args...) for (ll i = vtx[u], ##args; ~i; i = eg[i].nxt) #define fulset(x, v) memset(x, v, sizeof(x)); int sum; template<classType> voidpermut_repeat(Typea[], inthead, inttail) { if (head == tail) { sum++; for (int i=0;i<=tail;i++) cout << a[i]; cout << endl; return; } for (int i=head;i<=tail;i++) { bool flag = false; for (int j=head;j<i;j++) if (a[i]==a[j]) { flag = true; break; } if (head==i) flag = false; if (flag) continue; swap(a[head], a[i]); permut_repeat(a, head+1, tail); swap(a[head], a[i]); } return; } intmain() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); // if need file I/O, activate this int n; cin >> n; char a[10000]; for (int i=0;i<n;i++) cin >> a[i]; sum=0; permut_repeat(a, 0, n-1); cout << sum << endl; }
#include<bits/stdc++.h> #define INF 0x3f3f3f3 #define maxn 100100 typedeflonglong ll; usingnamespacestd; #define rep(i, n, args...) for (ll i = 0, ##args; i < n; i++) #define repr(i, s, e, args...) for (ll i = s, ##args; i < e; i++) #define erg(i, u, args...) for (ll i = vtx[u], ##args; ~i; i = eg[i].nxt) #define fulset(x, v) memset(x, v, sizeof(x));
int sum;
voidfac(int number) { if (number==1) { sum++; return; } for (int i=number;i>=2;i--) { if (number %i!=0) continue; fac(number/i); } return; }
intmain() { int n; cin >> n; sum=0; fac(n); cout << sum << endl; }