Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int a(int[] input)
- {
- return intsqrt(intsqrt(sum_factors(input[0])))
- + num_factors(input[1])*11
- + intsqrt(intsqrt(sum_factors(input[2])))*2;
- }
- int sum_factors(int n)
- {
- int a=0,c=1;
- for (n = Math.abs(n)
- ;
- ++c*c <= n
- ;
- a += n % c < 1 ? c : 0,
- n /= n % c < 1 ? c-- : 1);
- return a + n;
- }
- int num_factors(int n)
- {
- int b=1,c=1;
- for (n = Math.abs(n)
- ;
- ++c*c <= n
- ;
- b += n % c < 1 ? 1 : 0,
- n /= n % c < 1 ? c-- : 1);
- return b;
- }
- int intsqrt(int $)
- {
- return (int)Math.sqrt($);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement