Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1.  
  2. int[] simpleMathGame(int[] A) {
  3.  
  4. int a[] = {1,0}, i = 1, l, m, j, c[] = new int[l = 99999];
  5. for(int u : A){
  6. for(j = 1; j*++j < u; )
  7. for( ; u%j<1 ; c[j]++ )
  8. u /= j;
  9. c[u]++;
  10. }
  11.  
  12. for( ; ++i < l ; ){
  13.  
  14. a[0] *= Math.pow(i, c[i]/=A.length);
  15. for(int u : A){
  16. for(m = 0 ;u%i < 1;m++)
  17. u/=i;
  18.  
  19. a[1] += m<c[i]?c[i]-m:0;
  20. }
  21. }
  22.  
  23. return a;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement