fork(9) download
  1. import java.math.*;
  2. class M{
  3. static int c(int n){
  4. BigInteger p, a = p = BigInteger.TEN.pow(1010).multiply(new BigInteger("2"));
  5. for(int i = 1; a.compareTo(BigInteger.ZERO) > 0; p = p.add(a)){
  6. a = a.multiply(new BigInteger(i+"")).divide(new BigInteger((2 * i++ + 1)+""));
  7. }
  8. return (p+"").charAt(n) - 48;
  9. }
  10.  
  11. public static void main(String[] a){
  12. System.out.print(c(0)+", ");
  13. System.out.print(c(1)+", ");
  14. System.out.print(c(2)+", ");
  15. System.out.print(c(3)+", ");
  16. System.out.print(c(4)+", ");
  17. System.out.print(c(11)+", ");
  18. System.out.print(c(101)+", ");
  19. System.out.print(c(600)+", ");
  20. System.out.print(c(761)+", ");
  21. System.out.print(c(1001));
  22. }
  23. }
Success #stdin #stdout 0.12s 711680KB
stdin
Standard input is empty
stdout
3, 1, 4, 1, 5, 8, 8, 2, 4, 3