2015年11月15日
来源:互联网 发布:淘宝连帽 编辑:程序博客网 时间:2024/06/06 09:02
好久没做杭电了,2017,也是很简单的 。这里就是next()与nextLine()的区别 。 public static void main(Stringargs[]){ Scanner sc=new Scanner(System.in); int n = sc.nextInt(); }
import java.util.Scanner;
class Main{
while(n-->0){
int count=0;
String str=sc.next();//nextLine()
for(int i=0;i
if(str.charAt(i)>='0'&&str.charAt(i)<='9'){
count++;
}
}System.out.println(count);
}
}
nextline应该是回车键前的,所以后来运行输入2回车就有了0,next就不会。只是字符。如果需要输空格应该是需要nextline.
0 0
- 2015年11月15日
- 2015年5月11日-2015年5月15日一周总结
- 11月15日
- 11月15日
- 2015年3月15日工作总结
- 2015年04月15日学习
- 2015年05月15日
- 2015年05月15日
- 2015年05月15日
- 2015年10月15日总结
- 2015年10月15日
- 2015年2月11日
- 2015年3月11日工作总结
- 2015年3月11日
- 2015年7月11日UITableView3
- 2015年7月11日-FW
- 2015年9月11日
- 2015年11月5日小记
- laravel 框架自带表单验证
- 2015年11月03日
- 数据库的事务隔离级别
- 2015年11月04日
- 2015年11月05日
- 2015年11月15日
- 2015年11月30日
- 2020 绝对值排序
- 哈希检索方面的论文、代码和数据集Learning to Hash Paper, Code and Dataset
- 杭电2021 发工资咯:)
- get,post中文乱码
- 装饰者模式
- 杭电2022 海选女主角
- button的边框