solutions: 282A
This commit is contained in:
parent
bdb9534633
commit
fe9f857c2b
1 changed files with 26 additions and 0 deletions
26
solutions/clang/282A.c
Normal file
26
solutions/clang/282A.c
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int n,i;
|
||||||
|
scanf("%d", &n);
|
||||||
|
|
||||||
|
getchar();
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
char operation[4];
|
||||||
|
scanf("%s", operation);
|
||||||
|
|
||||||
|
if (strcmp(operation, "X++") == 0 || strcmp(operation, "++X") == 0) {
|
||||||
|
count += 1;
|
||||||
|
} else if (strcmp(operation, "X--") == 0 || strcmp(operation, "--X") == 0) {
|
||||||
|
count -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d\n", count);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue