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