修改文件结构。

This commit is contained in:
unlockable
2023-02-21 10:56:54 +08:00
parent a64cfdd9f3
commit 40182871f4
83 changed files with 0 additions and 0 deletions

37
POP/06/Optional03.c Normal file
View File

@@ -0,0 +1,37 @@
#include <stdio.h>
int main() {
int root = 2;// 若一个数有奇数个因子,那么它一定是平方数
int possibleFactor = 0;
int factorCount = 0;
int factors[5] = {0};
int testee = 0;
factors[0] = 1;
printf("1~1000内只包含5个因子的数是:\n");
for (;root < 32; root++) {
//31^2 < 1000 ^ 32^2只用考虑到31
testee = root*root;
factorCount = 0;
factors[2] = root;
factors[4] = testee;
for (possibleFactor = 2; (possibleFactor < root); possibleFactor++) {
if (testee % possibleFactor == 0) {
if (factorCount == 0) {
factors[1] = possibleFactor;
factors[3] = testee / possibleFactor;
factorCount++;
}
else {
factorCount++;
break;
}
}
}
if (factorCount == 1) {
printf("%3d: %4d%4d%4d%4d%4d\n",testee, factors[0], factors[1], factors[2], factors[3], factors[4]);
}
}
return 0;
}