随笔分类 -  大数

hdu 1316(java大数)
摘要:/** java大数*/import java.util.Scanner;import java.math.BigInteger;public class hdu1316{ public static void main(String args[]) { BigInteger []fib = new BigInteger[500]; fib[1] = BigInteger.ONE; fib[2] = new BigInteger("2"); for (int i=3; i<500; ++i) { ... 阅读全文
posted @ 2012-04-11 17:46 Try86 阅读(174) 评论(0) 推荐(0)
hdu 1250(java大数)
摘要://java大数import java.util.Scanner;import java.math.BigInteger;public class hdu1250{ public static void main(String args[]) { Scanner cin = new Scanner(System.in); int n; while (cin.hasNextInt()) { n = cin.nextInt(); if (n <= 4) { ... 阅读全文
posted @ 2012-04-05 22:00 Try86 阅读(220) 评论(0) 推荐(0)
hdu 1261(组合数+java大数)
摘要:设多重集的个数n = n1 + n2 + ... + nk;则该多重集的排列个数为:n!/(n1!n2!...nk!).//组合数+java大数import java.util.Scanner;import java.math.BigInteger;public class hdu1261{ public static void main(String args[]) { Scanner cin = new Scanner(System.in); BigInteger f1, f2; int []s = new int[26]; int n, sum; n = cin.nextIn... 阅读全文
posted @ 2012-04-05 21:04 Try86 阅读(402) 评论(0) 推荐(0)
hdu 1041(规律+打表+java大数)
摘要:串中出现01时,在下一步后就会出现连续的两个0规律:i为偶数时:f[i] = f[i-1] * 2 + 1; i为奇数时:f[i] = f[i-1] * 2 - 1。//规律+打表+java大数import java.util.Scanner;import java.math.BigInteger;public class CT{ public static void main(String args[]) { Scanner cin = new Scanner(System.in); BigInteger []f = new BigInteger[10... 阅读全文
posted @ 2012-04-04 14:59 Try86 阅读(238) 评论(0) 推荐(0)
hdu 1042(java大数)
摘要://java大数import java.util.Scanner;import java.math.BigInteger;public class NF{ public static void main(String args[]) { int n; Scanner cin = new Scanner(System.in); BigInteger sum; while (cin.hasNextInt()) { n = cin.nextInt(); sum = new B... 阅读全文
posted @ 2012-04-04 13:51 Try86 阅读(198) 评论(0) 推荐(0)
hdu 1002(java大数)
摘要:import java.math.BigInteger;import java.util.Scanner;public class Main{ public static void main(String args[]) { Scanner reader = new Scanner(System.in); int t, cas; cas = 0; t = reader.nextInt(); while ((t--) != 0) { BigInteger a, b, c; ... 阅读全文
posted @ 2012-04-03 20:05 Try86 阅读(267) 评论(0) 推荐(0)