1 solutions

  • 0
    @ 2023-11-24 0:26:46
    #include<iostream>
    #include<math.h>
    using namespace std;
    
    int num(int n)
    {
    	int sum = 0;
    	for (int i = 1;i < n;i++)
    		if (n % i == 0)
    			sum += i;
    	return sum;
    
    }
    int main() {
    	int a, b;
    	for ( a = 1;a++;)
    	{
    		b = num(a);
    		if (a != b && a == num(b))
    		{
    			cout << a <<" "<< b;
    			break;
    		}
    	}
    	
    	system("pause");
    	return 0;
    }
    
    • 1

    Information

    ID
    6798
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    6
    Tags
    (None)
    # Submissions
    62
    Accepted
    21
    Uploaded By