Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tipar
- int valid (int k)
- {
- return 1;
- }
- int solutie (int k)
- {
- return (k<=n)
- }
- void bktr() {
- int k = 1;
- st[k] = 0;
- while (k) {
- if (st[k] < n) {
- st[k]++;
- if (valid(k)) {
- if (sol(k))
- tipar(k);
- else {
- k++;
- st[k] =st[k-1];
- }
- }
- }
- else
- k--;
- }
- }
- int main() {
- cin >> n;
- bktr();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement