Advertisement
Ritam_C

bit++ method 1

Feb 21st, 2021
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5. ios_base::sync_with_stdio(false);
  6. cin.tie(NULL);
  7. int n;
  8. cin >> n;
  9. int a[2] = {0};
  10. while(n--){
  11. string s;
  12. cin >> s;
  13. if(s[1] == '+'){
  14. a[0]++;
  15. } else{
  16. a[1]++;
  17. }
  18. }
  19. cout << a[0]-a[1];
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement