北邮09复试模拟problem B
来源:互联网 发布:英文词典 知乎 编辑:程序博客网 时间:2024/05/17 23:48
数字统计Submit: 1420 Accepted:699Time Limit: 1000MS Memory Limit: 65536K
Description
给你一个非常大的整数x,(-10^400 <=x<= 10^400),请统计x的每一位,分别输出9,1,2出现的次数.
Input
一个大整数;
Output
一共三行,第一行是9出现的次数,第二行是1出现的次数,第三行是2出现的次数。
Sample Input
912912912910915902
Sample Output
6
5
4
Source
import java.util.*;
public class test {
int nine,two,one;
public static void main(String[] args){
Scanner sca = new Scanner(System.in);
char[] a=new char[402];
while(sca.hasNext()){
int nine=0,two=0,one=0;
String ex=sca.next();
a=ex.toCharArray();
int l=a.length;
for(int i=0;i<l;i++){
switch (a[i]) {
case '9':
nine++;
continue;
case '2':
two++;
continue;
case '1':
one++;
continue;
default:
break;
}
}
System.out.println(nine);
System.out.println(one);
System.out.println(two);
}
}
}
- 北邮09复试模拟problem B
- 北邮08复试模拟problem B
- 北邮09复试模拟problem c
- 北邮09复试模拟problem A
- 北邮08复试模拟problem A
- 北邮08复试模拟problem C
- poj_1000 A+B Problem 模拟
- 【MAP模拟】SDUT 1471 A + B problem
- hdu_1013_A + B Problem II_(模拟)
- 【模拟】洛谷 P1001 A+B Problem
- CSU1642-Problem B-前缀和数组/模拟
- HDU 1002 A + B Problem II(模拟)
- NYOJ 513 & HDU 1753 A+B Problem IV(模拟)
- 【hdoj1002】 A + B Problem II(模拟加法)
- A + B Problem II HDU 1002 ——大数模拟
- hdu 1002 A + B Problem II(大数模拟加法)
- Codeforces 202B Brand New Easy Problem(模拟)
- Codeforces--629B--Far Relative’s Problem(模拟)
- 关于ARM的22个常用概念--的确经典
- 你能为这个世界做些什么?
- C# char[] 与 string之间的转换
- ant 构建
- 新的征程
- 北邮09复试模拟problem B
- Qt下中文乱码问题的解决办法
- 方法到习惯2010-03-07
- FCL小应用系列-----------如何判断文件是否存在?
- 线程的创建和启动
- STL的 string 类赋值
- 推荐两篇‘蚁族’的自述文章
- 虚拟摄像头
- JXL一个错误的优化方案