7 solutions

  • 0
    @ 2024-8-23 9:49:01
    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n;
    	cin>>n;
    	for(int i=1;i<=n;i++)
    	{
    		int a;
    		vector <int>h; 
    		cin>>a; 
    		for(int j=1;j<=a/j;j++)
    		{
    			if(a%j==0)
    			{
    				h.push_back(j);
    				if(a/j!=j)h.push_back(a/j); 
    			 } 
    		}
    		sort(h.begin(),h.end());
    		reverse(h.begin(),h.end());
    		while(h.size())
    		{
    			cout<<h.back()<<" ";
    			h.pop_back();
    		}
    		cout<<endl;
    	}
    	return 0;
     }
    

    Information

    ID
    179
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    # Submissions
    85
    Accepted
    20
    Uploaded By