Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int n, st[30];
- ofstream fout("morse.out");
- void tipar() {
- fout << '.';
- for (int i = 1; i <= n; i++)
- if (st[i] == 1)
- fout << '.';
- else
- fout << '-';
- fout << '.' << endl;
- }
- void bktr(int k) {
- if (n == k - 1) {
- tipar();
- return;
- }
- for (int i = 1; i <= 2; i++) {
- st[k] = i;
- bktr(k + 1);
- }
- }
- int main() {
- cin >> n;
- n -= 2;
- bktr(1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement