---------------------------------
简单的字符判断。
AC代码:
1 import java.util.Scanner; 2 3 public class Main { 4 5 public static void main(String[] args) { 6 7 Scanner sc=new Scanner(System.in); 8 9 int times=Integer.parseInt(sc.nextLine());10 while(times-->0){11 int ans=0;12 int n=Integer.parseInt(sc.nextLine());13 while(n-->0){14 if(sc.nextLine().indexOf("+")!=-1){15 ans++;16 }else{17 ans--;18 }19 }20 System.out.println(ans);21 }22 23 }24 25 }
题目来源: