282A. Bit++
Problem Link: https://codeforces.com/problemset/problem/282/A
Solution 1:
import java.util.*;
public class A282 {
public static Scanner scn = new Scanner(System.in);
public static int finalAns(int n){
String str = "";
int ans = 0;
for(int i=0;i<n;i++){
str=scn.next();
if(str.charAt(0)=='+' || str.charAt(2)=='+') ans++;
else ans--;
}
return ans;
}
public static void main(String[] argv){
int n = scn.nextInt();
System.out.println(finalAns(n));
}
}
No comments:
Post a Comment
Thanks