added double jump and sitting state

This commit is contained in:
nihonium 2023-02-25 19:34:24 +03:00
parent 2e5c5a8dde
commit 90d07dde3f
Signed by: nihonium
GPG key ID: 0251623741027CFC
148 changed files with 13050 additions and 0 deletions

View file

@ -0,0 +1,35 @@
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int string_sum(const string& str) {
int res = 0;
int x;
int n = str.size();
int i = 0;
while (i < n) {
switch (str[i]) {
case '[':
case ',' :
sscanf((str.c_str()) + i + 1, "%d", &x);
res += x;
break;
case ']' :
return res;
case ' ':
break;
default:
break;
}
++i;
}
return -1;
}
int main() {
string meow;
getline(cin, meow);
cout << string_sum(meow) << endl;
}