[编程题]字符个数统计
字符个数统计
http://www.nowcoder.com/questionTerminal/eb94f6a5b2ba49c6ac72d40b5ce95f50
/位存储 c++ bitset, 省空间/
#include <iostream>
#include <bitset>
using namespace std;
int main(int argc, char* argv[])
{
char c;
int count;
bitset<128> setTest(0);
while (c = getchar())
{
if (c == '\n')
{
break;
}
setTest.set(c, 1);
}
cout << setTest.count() << endl;
return 0;
}
海康威视公司福利 1160人发布