inputstream - Java Scanner doesn't read all the inputs -
i have input 1000002 lines. first line has 2 number n, q. there n number 1 n in next line , q lines after second line.
in input, n 100000 , q 1000000.
when try read inputs java code, paste stdin although last input copied, code doesn't reach end , seems didn't read inputs. here code:
import java.util.scanner; import java.util.list; import java.util.arraylist; import java.lang.*; import java.io.*; public class test { public static void main(string[] args) { int n; int q; scanner s = new scanner(system.in); n = s.nextint(); q = s.nextint(); (int = 0; < n; i++) { int id = s.nextint(); } for(int = 0; < q; i++) { int nodex = s.nextint(); int nodey = s.nextint(); } s.close(); system.out.println("done"); } }
here input file 12 mb :) input.txt
also when try print know number of read inputs, last 950000.
so what's wrong this?
Comments
Post a Comment