fork download
  1. import java.util.*;
  2.  
  3. class Task3
  4. {
  5. public static void main (String[] args)
  6. {
  7. int m, n;
  8. double S = 0;
  9. Scanner in = new Scanner(System.in);
  10. m = in.nextInt();
  11. n = in.nextInt();
  12. for (int i = 1; i <= m; i++)
  13. {
  14. for (int j = 1; j <= n; j++)
  15. {
  16. S += 1.0/(i + j*j);
  17. }
  18. }
  19.  
  20. System.out.println(S);
  21. }
  22. }
Success #stdin #stdout 0.07s 4386816KB
stdin
164
395
stdout
34.750965089629275