NYOJ题目1049自增自减

---------------------------------

简单的字符判断。

 

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 }

 

题目来源: http://acm.nyist.net/JudgeOnline/problem.php?pid=1049

相关文章:

  • 2021-10-03
  • 2021-12-03
  • 2021-06-10
  • 2022-03-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-12
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2022-01-25
  • 2021-12-07
  • 2021-09-26
相关资源
相似解决方案