Ejemplo n.º 1
0
int PermutationSum::add (int n) 
{
	SS ss;
	ss << n;
	ST st;
	st = ss.str();
	sort(all(st));
	cout << ss.str() << endl;
	int ret = 0;
	
	do {
		ret += atoi(st.c_str());
	} while(next_permutation(all(st)));
	
	return ret;
}
Ejemplo n.º 2
0
int main() {
  String input;
  char c;

  while(std::cin >> input) {
    Stack s;
    SS ss;    
    
    unsigned int j = 0;
    while(j < input.size() && isprint(c = input[j++])) {
      if(c == '[') {
	unsigned int k = j;
	while(isNormalLetter(c = input[k]))
	  ++k;
	if(k == j)
	  continue;
	input[k] = '\0';
	s.push(String(&input[j]));
	input[k] = c;
	j = k;
      }
      else if(c == ']') {
        // nop
      }
      else {
	ss << c;
      }
    }

    // First print Stack, then SS.
    while(!s.empty()) {
      std::cout << s.top();
      s.pop();
    }
    std::cout << ss.str() << std::endl;
  }
}
Ejemplo n.º 3
0
Archivo: t2.cpp Proyecto: rve/conf
template < class T > string converter( T n ){SS x;x << n;return x.str();} 
string convtos (T a)
{
    SS ss;
    ss << a;
    return ss.str();
}