l******c 发帖数: 2555 | 1 RPRPRPRP
welcome to optimize
//012 string to represent binary value
#include
#include
set st;
void bin21(string str, int start)
{
int end = str.length() -1 ;
if(start >= end)
return;
while((str[start] == '0') && (start < end)) start++;
if((str[start +1] == '0') && (start < end))
{
//not change
bin21(str, start + 1);
//change
if(str[start] == '1')
{
str[start] = '0';
str[start + 1] = |
|
|
|
|
|
y******m 发帖数: 281 | 6 包子包子包子我要吃包子~
RPRPRPRP帮肥牛攒RP~ |
|
|