import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* 输入t组数,每一组数为N;
* 找到N=x*y,其中x为偶数,y为奇数,找到了打印出来,否则输出"No"
* @author lily
*
*/
public class Main {
public static void main(String[] args) {
System.out.println("222222");
Scanner sc = new Scanner(System.in);
// 接收测试样例数
int nNum =0;
int input=0;
do{
input=sc.nextInt();
}while(!(input >=1 && input <= 1000));
nNum=input;
List<Integer> nList = new ArrayList<Integer>(nNum);
// 接收测试样例
try{
for (int i = 0; i < nNum; ) {
int inputN=0;
do{
inputN=sc.nextInt();
}while(!(inputN >=2 && inputN < Math.pow(2,63)));
nList.add(inputN);
i++;
}
}catch(ArrayIndexOutOfBoundsException e){
System.out.println("数组越界!");
e.printStackTrace();
}
for (int i = 0; i < nList.size(); i++) {
int N = nList.get(i);
if (N % 2 != 0) {
System.out.println("No");
} else {
int y = 0;
y = findY(N);
if (y != -1) {
System.out.println(y + " " + (N / y));
}
}
}
sc.close();
}
public static int findY(int n) {
int temp = 0;
temp = n / 2;
if (temp % 2 == 0) {
findY(temp);
return -1;
} else {
return temp;
}
}
}
京东2019实习笔试部分编程题
最新推荐文章于 2019-06-14 23:42:12 发布