50分,有5个点MLE,求大佬
查看原帖
50分,有5个点MLE,求大佬
308146
richNG楼主2020/5/28 17:03
import java.util.Scanner;

/**
 * @author 为祖国添砖java 2020年5月26日 下午6:19:05
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sp = new Scanner(System.in);

		String s = "";
		
		// String[] b = new String[]{"1",2,3,4,5,6,7,8,9,0",};
		while (sp.hasNext()) {
			int m = sp.nextInt();
			int n = sp.nextInt();
			int[] a = new int[10];
			for (int i = m; i <= n; i++) {
				s += i;
			} // System.out.println(s);
			for (int i = 0; i < 10; i++) {
				for (int j = 0; j < s.length(); j++) {
					char s1 = s.charAt(j);

					if (i == (int) s.charAt(j) - 48) {
						a[i]++;
					} // System.out.print(s1+" ");
				}

			}
			for (int i = 0; i < a.length; i++) {
				System.out.print(a[i] + " ");
				a[i]=0;
                s = "";
   
			}
		}
	}

}
2020/5/28 17:03
加载中...