1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| #include <stdio.h> #include <string.h>
int main() { int n, x = 0; scanf("%d", &n); char op[5];
for (int i = 0; i < n; i++) { scanf("%s", op); if (strchr(op, '+')) { x += 1; } else { x -= 1; } } printf("%d\n", x); return 0; }
|