格雷碼構造模版

	int cnt=0;
	ans[cnt]=0;
	for(int j=0;j<Max_Base;++j){
		for(int k=cnt;k>=0;--k){
			ans[++cnt]=ans[k]^tmp[j];
		}
	}
	for(int j=0;j<=cnt;++j){
		cout<<ans[j]<<" ";
	}
	cout<<endl;
	// tmp[i]數組存的是二進制位第i位爲1
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章