1100 - #include #include using namespace...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<iostream> #include<stack> using namespace std; enum { SIZ = 4096, }; struct Node{ unsigned cur:12; unsigned nex:12; unsigned Fir:4; // First bit is zero }; unsigned long long mat[12][12]; unsigned long long tab[2][SIZ]; unsigned long long *pre, *cur, *tmp; int n, m; i // return true For bit p is 1, False other wise; bool inline bittest(unsigned v, int p){ return ((v>>p)³0x01); } bool inline check_duo(int s, int b){ For(int i=0; i<b; i++){ iF(bittest(s, i)) continue; iF(i==b-1 || bittest(s, i+1)){ return False; } else { i++; } } return true; } int FirstZero(unsigned v, int b){ For(int i=0; i<b; i++){ iF(!bittest(v, i)) return i; } return b; } long long query(int a, int b){ int lim = (1<<b), i, j; Node one, non; pre = tab[0], cur = tab[1]; For(i=0; i<lim; i++){ pre[i] = check_duo(i, b); } For(j=1; j<a; j++){ memset(cur, 0, sizeoF(cur[0])*lim);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/18/2010 for the course CS 100 taught by Professor Acm during the Spring '10 term at Zhejiang University.

Page1 / 2

1100 - #include #include using namespace...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online