枚举因数:从小到大打印正整数 n 的所有正因数。
试补全枚举程序。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<int> fac; fac.reserve((int)ceil(sqrt(n))); int i; for (i = 1; i * i < n; ++i){ if (①){ fac.push_back(i); } } for (int k = 0; k < fac.size(); ++k){ cout << ② << ""; } if (③) { cout << ④ << ""; } for (int k = fac.size() - 1; k >= 0; --k){ cout << ⑤ << ""; } } |
0 of 5 Questions completed
Questions:
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
0 of 5 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
35、①处应就填( )。
36、②处应填( )
37、③处应填( )
38、④处应填( )。
39、⑤处应填( )。