SHOW:
|
|
- or go back to the newest paste.
| 1 | int a(int[] input) | |
| 2 | {
| |
| 3 | - | return intsqrt(intsqrt(f(input[0]))) |
| 3 | + | return intsqrt(intsqrt(sum_factors(input[0]))) |
| 4 | - | + g(input[1])*11 |
| 4 | + | + num_factors(input[1])*11 |
| 5 | - | + intsqrt(intsqrt(f(input[2])))*2; |
| 5 | + | + intsqrt(intsqrt(sum_factors(input[2])))*2; |
| 6 | } | |
| 7 | ||
| 8 | - | int f(int n) |
| 8 | + | int sum_factors(int n) |
| 9 | {
| |
| 10 | int a=0,c=1; | |
| 11 | for (n = Math.abs(n) | |
| 12 | ; | |
| 13 | ++c*c <= n | |
| 14 | ; | |
| 15 | a += n % c < 1 ? c : 0, | |
| 16 | n /= n % c < 1 ? c-- : 1); | |
| 17 | return a + n; | |
| 18 | } | |
| 19 | ||
| 20 | - | int g(int n) |
| 20 | + | int num_factors(int n) |
| 21 | {
| |
| 22 | int b=1,c=1; | |
| 23 | for (n = Math.abs(n) | |
| 24 | ; | |
| 25 | ++c*c <= n | |
| 26 | ; | |
| 27 | b += n % c < 1 ? 1 : 0, | |
| 28 | n /= n % c < 1 ? c-- : 1); | |
| 29 | return b; | |
| 30 | } | |
| 31 | ||
| 32 | int intsqrt(int $) | |
| 33 | {
| |
| 34 | return (int)Math.sqrt($); | |
| 35 | } |