|
|
back to boardShow all messages Hide all messagesSoln accepted but time is .156 how to reduce to atleast 0.078 and also how to reduce memory usuage? import java.util.*; import java.io.*; public class prob1264{ public static void main(String args[]) { Scanner sc=new Scanner(System.in); PrintWriter out=new PrintWriter(System.out); int n=sc.nextInt(); int m=sc.nextInt(); int result=n*(m+1); out.print(result); out.close(); } } Just use such construction, I have time 0.093: StreamTokenizer in = new StreamTokenizer(new BufferedReader( new InputStreamReader(System.in))); PrintWriter out = new PrintWriter( new OutputStreamWriter(System.out), true);
in.nextToken(); int n = (int)in.nval; in.nextToken(); int m = (int)in.nval;
out.println(n * (m + 1)); I know the problem! You're using Java. |
|
|