PAT1094 谷歌的招聘

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.util.*;
public class Main {
	
	public static void main(String[] args) throws IOException {
		BigInteger bg;
		boolean found = false;
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String line = null;
        line = bf.readLine();
        String[] LK = line.split(" ");
        int K = Integer.parseInt(LK[1]);
        int L = Integer.parseInt(LK[0]);
        line=bf.readLine();
		for (int i = 0; i < line.length()-K+1; i++) {
			bg = new BigInteger(line.substring(i,i+K));
			if (bg.isProbablePrime(12)) {
				int subLength = bg.toString().length();
				if(subLength

注意:1、subString左闭右开 2、0一定要补上输出,不然格式不对

你可能感兴趣的:(Java,oj)