博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
NYOJ题目1049自增自减
阅读量:4497 次
发布时间:2019-06-08

本文共 719 字,大约阅读时间需要 2 分钟。

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

简单的字符判断。

 

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 }

 

题目来源:

转载于:https://www.cnblogs.com/cc11001100/p/5875697.html

你可能感兴趣的文章
蘑菇街基于Docker的私有云实践
查看>>
堆和优先队列
查看>>
宽度优先搜索
查看>>
leetcode63 Unique Paths II
查看>>
兼容多浏览器的本地存储
查看>>
3分钟实现网页版多人文本、视频聊天室 (含完整源码)
查看>>
取消一个本地svn目录与svn的联系
查看>>
C++中值传递(pass-by-value)和引用传递(pass-by-reference)
查看>>
maven也是apache下的项目
查看>>
python -- 程序异常与调试(程序调试)
查看>>
TensorFlow的学习
查看>>
HAOI2007 反素数ant
查看>>
从提升树到 XGBoost, 原理简介
查看>>
java--遇到NoSuchMethodError通用解决思路
查看>>
DDS视图&Button控件
查看>>
npm全局路径及cache路径设置
查看>>
实验6-数组(1)
查看>>
Ubuntu --- not enough free disk space
查看>>
HDU3068(Manacher算法)
查看>>
Mysq数据库备份(win)
查看>>