Posted in 面试题 onJuly 16, 2014
void prim(int m, int n) {
if(m>n) {
while(m%n != 0) n++;
m /= n;
prim(m, n);
printf(“%d*”, n);
}
}
int main(int argc, char* argv[]) {
int n = 435234;
printf(“%d=”, n);
prim(n, 2);
}
if(m>n) {
while(m%n != 0) n++;
m /= n;
prim(m, n);
printf(“%d*”, n);
}
}
int main(int argc, char* argv[]) {
int n = 435234;
printf(“%d=”, n);
prim(n, 2);
}
分解成质因数(如435234=251*17*17*3*2,据说是华为笔试题)
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Tags in this post...
Reply on: @reply_date@
@reply_contents@