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. // your code goes here
  13. long x = 0;
  14. for (int i= 1; i <= 1000; i++) {
  15. x += (long)i * (long)(i+1);
  16. }
  17. x /= 2L;
  18. System.out.printf("%12d%n", x);
  19. System.out.printf("%12d%n", 1000L*1000L*1000L);
  20.  
  21. long y = (2L * 1000L*1000L*1000L+ 3L*1000L*1000L) / 12L;
  22. System.out.printf("%12d%n", y);
  23. }
  24. }
Success #stdin #stdout 0.1s 48412KB
stdin
Standard input is empty
stdout
   167167000
  1000000000
   166916666