Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef unsigned long long ull;
  4. int sum (ull n){
  5. int result(0);
  6. while (n > 0){
  7. result += (n % 10);
  8. n /= 10;
  9. }
  10. return result;
  11. }
  12. int main(){
  13. ull n;
  14. cin >> n;
  15. for (ull l(n); l <= min((ull)63500000, n * 100); l += n){
  16. if (l == sum(l) * n){
  17. cout << l;
  18. exit(0);
  19. }
  20. }
  21. cout << "0";
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement