Hi,
I have written some programs in Java (factorial, JULKA etc.) and they all seem to take 219 MB of memory ! I measured the memory usage using task manager on my pc, and it only shows around 7-8 MB usage ? Why is this SPOJ system showing such a high memory usage ?
As an example, the following program took 219 MB memory. You can try it on your computer. It only takes 7 MB on my PC. The problem number is 54 and the code is JULKA.
package sphere;
import java.io.*;
import java.math.*;
public class Problem54 {
public static void main(String[] args) {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
BigInteger two = new BigInteger("2");
for(int i = 0; i < 10; i++){
try
{
BigInteger first = new BigInteger(bf.readLine());
BigInteger second = new BigInteger(bf.readLine());
BigInteger big = first.max(second);
BigInteger small = first.min(second);
BigInteger answerOne = big.add(small).divide(two);
System.out.println(answerOne);
System.out.println(big.subtract(answerOne));
bf.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
}