奇♂妙拆分 题解
奇♂妙拆分
http://www.nowcoder.com/questionTerminal/0e6dec826f554dba828965df40abacb3
从1for到 即可.
sum要从1开始。
这道题没有卡数据 如果是 ,for到n的话会超时
import java.math.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.*; public class Main { public static void main(String args[])throws IOException { StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); in.nextToken(); int T = (int)in.nval; for(int t=0;t<T;t++) { in.nextToken(); int n = (int)in.nval; int sum=1,N=n; for(int i=1;i*i<n;i++) { if(n%i==0) { sum++; n/=i; } } out.println(sum); } out.flush(); } }