We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Mathematics
- Fundamentals
- Best Divisor
- Discussions
Best Divisor
Best Divisor
Sort by
recency
|
172 Discussions
|
Please Login in order to post a comment
My Python solution:
include
include
include
include
include
include
include
include
include
include
char* readline(); char* ltrim(char*); char* rtrim(char*);
int parse_int(char*);
int main() { int n = parse_int(ltrim(rtrim(readline())));
}
char* readline() { size_t alloc_length = 1024; size_t data_length = 0;
}
char* ltrim(char* str) { if (!str) { return '\0'; }
}
char* rtrim(char* str) { if (!str) { return '\0'; }
}
int parse_int(char* str) { char* endptr; int value = strtol(str, &endptr, 10);
}
Kristen loves playing with and comparing numbers. She thinks that if she takes two different positive numbers, the one whose digits sum to a larger number is better than the other. If the sum of digits is equal for both numbers, then she thinks the smaller number is better. For example, Kristen thinks that is better than and that is better than .
Given an integer, , can you find the divisor of that Kristin will consider to be the best?
Input Format
A single integer denoting .
Constraints
Output Format
Print an integer denoting the best divisor of .
Sample Input 0
Kristen's fascination with numbers is fascinating! Her method of comparing them based on the sum of their digits adds an intriguing twist. 11xplay
**Python 3: **