再present只用10000位10000布尔 [英] Represent 10000 booleans using only 10000 bits

查看:75
本文介绍了再present只用10000位10000布尔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要重新present 10000位信息。(每个人都可以是一个或零)。有没有什么办法可以做到这一点?

I want to represent 10000 bits of information.(Each can be either one or zero). Is there any way I can do this?

维基百科的解释有点本事以实现这一目标。但随后问我有一个数字,就是大到2 ^ 10000存储10000位。

Wikipedia explains a bit hack to achieve this. But then it asks me to have a number that's as large as 2^10000 for storing 10000 bits.

是否有某种方式,就是听话,甚至用于存储大量的位?

Is there some way that's tractable even for storing large number of bits?

推荐答案

随着维基百科的解释,有些字段是这里一个合适的选择。位域可容纳10000位有2 ^ 10000状态。

As wikipedia explains, a bit field is an appropriate choice here. a bit field that can hold 10,000 bits has 2^10000 states.

这样做的一个很好的选择(因为整数是32/64位)是位向量,这是询问和痛苦这里详细解释:

A good choice for doing this (given that integers are 32/64 bits) is a bit vector, which is asked about and explained in excruciating detail here:

<一个href="http://stackoverflow.com/questions/11400242/bit-vector-implementation-of-set-in-programming-pearls-2nd-edition/">bit在编程珠玑向量执行组,第2版

总的想法是,你使用整数被用作位字段的数组。

The general idea is that you use an array of integers which are used as bit fields.

这篇关于再present只用10000位10000布尔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆