fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int n = Integer.parseInt(br.readLine());
  13. double a[][] = new double[n][];
  14. double b[] = new double[n];
  15. for (int i = 0 ; i != n ; i++) {
  16. String[] tok = br.readLine().split(",");
  17. a[i] = new double[tok.length-1];
  18. for (int j = 0 ; j != a[i].length ; j++) {
  19. a[i][j] = Double.parseDouble(tok[j]);
  20. }
  21. b[i] = Double.parseDouble(tok[tok.length-1]);
  22. }
  23. System.out.println(Arrays.deepToString(a));
  24. System.out.println(Arrays.toString(b));
  25. }
  26. }
Success #stdin #stdout 0.1s 320256KB
stdin
3
2,3,4,5
6,7,8
9,10
stdout
[[2.0, 3.0, 4.0], [6.0, 7.0], [9.0]]
[5.0, 8.0, 10.0]