#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; //因子成对出现,遍历范围1到n的平方根 for(int i = 1; i <= sqrt(n); i++){ //判断n能否被i整除,能整除则i就是因子 if(n%i == 0){ cout << n << "=" << i << "*" << n/i << endl; } } return 0; }
By signing up a 追梦算法网 universal account, you can submit code and join discussions in all online judging services provided by us.
Using your 追梦算法网 universal account