Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef unsigned long long ull;
- int sum (ull n){
- int result(0);
- while (n > 0){
- result += (n % 10);
- n /= 10;
- }
- return result;
- }
- int main(){
- ull n;
- cin >> n;
- for (ull l(n); l <= min((ull)63500000, n * 100); l += n){
- if (l == sum(l) * n){
- cout << l;
- exit(0);
- }
- }
- cout << "0";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement