LanQiaoTestCodes/数数.java

31 lines
539 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package LanQiaoOJ;
/*
* 问题描述
任何一个大于1的正整数都能被分解为若干个质数相
比如28=2×2×7被分解为了三个质数相乘。
请问在区间[2333333,23333333]中有多少个正整数
可以被分解为12个质数相乘*/
public class 数数 {
static int ans=0;
public static void main(String[] args) {
for(int i=2333333;i<2333333;i++) {
int t=i;
int x=0;
for(int j=2;j<j/t;j++) {
while(t%j==0) {
x++;
t/=j;
}
}
if(t>1) {
x++;
}
if(x==12)
ans++;
}
System.out.print(ans);
}
}