Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
54424 | 张思存 | 求正整数2和n之间的完全数 | C++ | Accepted | 0 MS | 240 KB | 325 | 2024-10-27 22:19:46 |
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; for(int j=2;j<=n;j++){ int cnt=0; bool b=0; for(int i=1;i<j;i++){ if(j%i==0){ cnt+=i; } } if(cnt==j){ b=1; } if(b){ cout<<j<<endl; } } return 0; }