Codeforces Round #173 (Div. 2), problem: (A) Bit++ solution: http://ideone.com/U6SD1p
#include <iostream> #include <cstdio> using namespace std; int main() { int n, r; char s[5]; r=0; scanf("%d", &n); while(n--) { scanf("%s", s); if(s[0]=='+' || s[1]=='+') r++; else r--; } printf("%d", r); return 0; }
No comments:
Post a Comment