Skip to content

Commit b9cc3e0

Browse files
author
lazylzg
committed
Update test6-7约数的个数.cpp
1 parent 5bb9aa4 commit b9cc3e0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

第6章数学问题/6.4分解质因数/test6-7约数的个数.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#include<iostream>
2-
32
using namespace std;
4-
//Ô¼ÊýµÄ¸öÊý
53

64
int yueshu(int num) {
7-
int answer=0,i;
5+
int i,answer=0;
86
for(i=1; i*i<num; i++) {
97
if(num%i==0) {
108
answer+=2;
@@ -15,11 +13,12 @@ int yueshu(int num) {
1513
}
1614

1715
int main() {
18-
int n,num;
16+
int n;
1917
while(scanf("%d",&n)!=EOF) {
2018
for(int i=0; i<n; i++) {
19+
int num;
2120
scanf("%d",&num);
22-
cout<<yueshu(num)<<endl;
21+
printf("%d\n",yueshu(num));
2322
}
2423
}
2524
return 0;

0 commit comments

Comments
 (0)