Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- char buffer[2100];
- int bs = 0;
- inline void put(char c) {
- buffer[bs++] = c;
- if (bs == 2048) {
- cout.write(buffer, 2048);
- bs = 0;
- }
- }
- int main()
- {
- int n;
- scanf("%d", &n);
- char v[9] = "12345678";
- do
- {
- for(int i = 0; i < n; i++)
- {
- put(v[i]);
- put(' ');
- }
- put('\n');
- } while(next_permutation(v, v+n));
- cout.write(buffer, bs);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement