1 条题解

  • 2
    @ 2023-10-3 14:38:19
    #include<iostream> 
    #include<cmath> 
    #include<cstdio> 
    #include<algorithm> 
    #include<cstring>
    #include<string> 
    using namespace std;
    int main(){
    	int n;
    	cin >> n;
    	int res;
    	for(int i=2;i<=n;i++){
    		res = 0;
    		for(int j=1;j<i;j++){
    			if(i%j == 0){
    				res+=j;
    			}
    		}
    		if(i==res){
    			cout << i << endl;
    		}
    	}
    	return 0;
    }
    
    • 1

    信息

    ID
    6938
    时间
    1000ms
    内存
    128MiB
    难度
    1
    标签
    (无)
    递交数
    15
    已通过
    10
    上传者