Advertisement
rotti321

PseudoPerfect

Oct 18th, 2017
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5.  
  6. int n,d,x,k=0;
  7. long long S=0;
  8. cin >> n;
  9.  
  10. S=1+n; ///Suma initiala
  11.  
  12. for(d=2;d*d<n;d++) /// [ 2, sqrt(n) )
  13. {
  14. if(n%d==0){
  15. S=S+ d + n/d;
  16. /// cout<<d<<" "<<n/d<<" "<<S<<endl;
  17. }
  18. }
  19. if(d*d==n){
  20. S=S+d;
  21. /// cout<<d<<" "<<S<<endl;
  22. }
  23.  
  24. if(S%n==0) cout<<"DA";
  25. else cout<<"NU";
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement