-
Notifications
You must be signed in to change notification settings - Fork 0
/
fact.cpp
45 lines (35 loc) · 876 Bytes
/
fact.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>
#include <stdio.h> // printf,scanf
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm> //sort,binarySearch
#include <functional>
#include <iomanip> // setprecision
#include <utility> // c+11 Array
#include <set>
#include <sstream>
#include <bits/stdc++.h>
#define PI 3.141592653589793238462643383279
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define pb(x) push_back(x)
#define debug(x) cout << #x << " = " << x << endl;
#define debret(x) debug(x) ; return 0;
using namespace std;
void fac(int rest, string s){
if(rest == 0){
cout << s << endl;
}else{
for(char c = 'a'; c <= 'c'; c++){
fac(rest-1,s+c);
}
}
}
int main(void){
int n;
cin >> n;
fac(n,"");
return 0;
}