Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ios>
- #include <new>
- #include <cstdio>
- #include <cmath>
- #include <cstring>
- #include <cctype>
- #include <cstdlib>
- #include <climits>
- #include <ctime>
- #include <assert.h>
- #include <istream>
- #include <ostream>
- #include <iostream>
- #include <iomanip>
- #include <algorithm>
- #include <vector>
- #include <string>
- #include <numeric>
- #include <fstream>
- #include <sstream>
- #include <map>
- #include <set>
- #include <list>
- #include <stack>
- #include <queue>
- #include <deque>
- #include <locale>
- #include <memory>
- #include <valarray>
- #include <complex>
- #include <limits>
- #include <bitset>
- #include <iterator>
- #include <utility>
- #include <exception>
- #include <functional>
- #include <streambuf>
- #include <typeinfo>
- #include <cxxabi.h>
- #include <tr1/cstdio>
- #include <tr1/cstdlib>
- #include <tr1/cmath>
- #include <tr1/climits>
- #include <tr1/cfenv>
- #include <tr1/cstdarg>
- #include <tr1/ctgmath>
- #include <tr1/cstdbool>
- #include <tr1/ctime>
- #include <tr1/cstdint>
- #include <tr1/cwchar>
- #include <tr1/cwctype>
- #include <tr1/cinttypes>
- #include <ext/algorithm>
- #include <ext/functional>
- #include <ext/new_allocator.h>
- #include <ext/pod_char_traits.h>
- #include <ext/vstring.h>
- #include <ext/stdio_filebuf.h>
- #include <ext/atomicity.h>
- #include <ext/concurrence.h>
- #include <ext/iterator>
- #include <ext/numeric>
- #include <ext/stdio_sync_filebuf.h>
- #include <ext/pool_allocator.h>
- #include <ext/array_allocator.h>
- #include <ext/debug_allocator.h>
- #include <ext/malloc_allocator.h>
- #include <ext/throw_allocator.h>
- #include <ext/bitmap_allocator.h>
- #include <ext/enc_filebuf.h>
- #include <ext/memory>
- #include <ext/rope>
- #include <ext/typelist.h>
- #include <ext/mt_allocator.h>
- #include <ext/slist>
- #include <ext/type_traits.h>
- #include <debug/bitset>
- #include <debug/string>
- #include <debug/deque>
- #include <debug/set>
- #include <debug/map>
- #include <debug/list>
- #include <debug/vector>
- #include <tr1/functional>
- #include <tr1/array>
- #include <tr1/memory>
- #include <tr1/tuple>
- #include <tr1/utility>
- #include <tr1/type_traits>
- #include <tr1/regex>
- #include <tr1/random>
- #include <tr1/unordered_set>
- #include <tr1/unordered_map>
- #include <ext/rb_tree>
- #include <ext/numeric_traits.h>
- #include <ext/codecvt_specializations.h>
- #define vinf (1 << 28)
- #define inf ((~0U) >> (1))
- #define pi (2.0 * acos(0.0))
- #define lowbit(x) ((x) & (-(x)))
- #define sine(x) (sin(radians(x)))
- #define cosine(x) (cos(radians(x)))
- #define tangent(x) (tan(radians(x)))
- #define arcsine(x) (degrees((asin(x))))
- #define arccosine(x) (degrees((acos(x))))
- #define arctangent(x) (degrees((atan(x))))
- #define clr(ar) (memset(ar, 0, sizeof(ar)))
- #define radians(x) (((1.0 * x * pi) / 180.0))
- #define degrees(x) (((x * 180.0) / (1.0 * pi)))
- #define read() (freopen("lol.txt", "r+", stdin))
- #define out() (freopen("out.txt", "w+", stdout))
- #define write() (freopen("lol.txt", "w+", stdout))
- #define dbg(x) (std::cout << #x << " = " << x << endl)
- #define twopow(x) ((((x & (x - 1)) == 0) && (x != 0)) ? (true) : (false))
- #define mod(n, m) ((n >= 0) ? (n % m) : ((abs(n) % m) == 0) ? 0 : (m - (abs(n) % m)))
- using namespace std;
- typedef uint32_t uint;
- uint lim, n, counter;
- void bitmask(uint d, uint c, uint l, uint r){
- uint b, a, s;
- if (!d){
- counter++;
- return;
- }
- a = (c | (l <<= 1) | (r >>= 1)) & lim;
- if (a != lim){
- --d;
- for (b = 1; b <= lim; b <<= 1){
- if (!(b & a)) bitmask(d, b | c, b | l, b | r);
- }
- }
- }
- int main(){
- //while (scanf("%hu", &n)){
- n = 14;
- counter = 0;
- lim = (1U << n) - 1;
- bitmask(n, 0, 0, 0);
- printf("Solutions: %d\n", counter);
- //}
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement