All pastes #732939 Raw Edit

Mine

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