All pastes #732944 Raw Edit

Unnamed

public cpp v1 · immutable
·published 2007-10-11 12:22 UTC
rendered paste body
#include <iostream>std::string s;int maxDepth, steps, bestSteps, p;void doit(int curDep){  if (s[p++] == '0') return;  ++steps;  if (++curDep > maxDepth) maxDepth = curDep, bestSteps = steps;  doit(curDep), doit(curDep);}int main(){  for (int c = 0; c < 10; ++c)    std::cin >> s >> s, maxDepth = -1, steps = 0, bestSteps = -1,    p = 0, doit(0), std::cout << bestSteps << std::endl;}