2013年2月19日

UVA 11076

摘要: import java.io.*;import java.util.*;import java.math.*;public classMain { static final int MAXN = 13; int A[] = {0, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600}; // 阶乘 int a[] = new int[10], n, x; // 大整数应用注意,Java中没有unsigned,用BigInteger代替c++中的unsigned long long int sol... 阅读全文

posted @ 2013-02-19 21:22 Sure_Yi 阅读(191) 评论(0) 推荐(0) 编辑

Java 大整数 BigInteger, BigDecimal使用方法

摘要: 从左往右计算BigInteger t = BigInteger.ONE; t = t.multiply(BigInteger.valueOf(3)).add(BigInteger.valueOf(2));answer : 5 t = BigInteger.ONE; t = t.add(BigInteger.valueOf(2)).multiply(BigInteger.valueOf(3));anwser : 6http://www.java3z.com/cwbwebhome/article/article8/81439.html?id=4322例子: BigInteger a = ... 阅读全文

posted @ 2013-02-19 20:55 Sure_Yi 阅读(983) 评论(0) 推荐(0) 编辑

容斥原理(模版 ZOJ 2836)

摘要: import java.io.*;import java.util.*;import java.math.*;public class Main { long m, ans; int n, a[]; long GCD(long a, long b) { // 中间结果用long保险,下LCM同 return b == 0 ? a : GCD(b, a % b); } long LCM(long a, long b) { return a / GCD(a, b) * b; } void dfs(long t... 阅读全文

posted @ 2013-02-19 20:04 Sure_Yi 阅读(196) 评论(0) 推荐(0) 编辑

导航