1 solutions

  • 0
    @ 2023-12-14 20:43:34
    #include <iostream>
    #include <bits/stdc++.h>
    using namespace std;
    int judge(int m){
    	int a = m;
    	int sum = 0;
    	do{
    		sum += m%10;
    		m /= 10;
    	}while(m != 0);
    	sum = a + sum;
    	return (sum);
    }
    int main()
    {
    	int n;
    
    	cin >> n;
    	for(int i = 1 ;i < n ;i++){
    		int flag = 0;
    		for(int j =i - 1 ;j >= 1;j--){
    			if(i == judge(j)){
    				flag = 1;
    				break;
    			}
    		}
    		if(flag == 0){
    			cout << i << "\n";
    		}
    	}
    	return 0;
    }
    
    • 1

    Information

    ID
    1190
    Time
    1000ms
    Memory
    512MiB
    Difficulty
    10
    Tags
    # Submissions
    11
    Accepted
    1
    Uploaded By