1 solutions

  • 0
    @ 2023-1-16 14:29:55
    #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;
    }
    
    
    • 1

    Information

    ID
    854
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    10
    Tags
    # Submissions
    7
    Accepted
    4
    Uploaded By