随笔分类 -  高精度

 
HDU 5050
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=5050大数gcdimport java.io.* ;import java.math.* ;import java.util.* ;import java.text.* ;public class Main { ... 阅读全文
posted @ 2014-10-06 22:32 LegendaryAC 阅读(214) 评论(0) 推荐(0)
HDU 5047
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=5047直到看到题解,我才知道这道题考的是什么首先交点数是Σ(16*i),区域区分的公式是 边数+点数+1=分成的区域数,可以得到公式当然不知道那个公式也可以手算第三项,把前三项放到OEIS(http://oeis.... 阅读全文
posted @ 2014-09-29 19:46 LegendaryAC 阅读(609) 评论(0) 推荐(1)
HDU 4927
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4927直接模拟会超时,要在纸上写写推公式A[n]*C(0,n-1) - A[n-1]*C(1,n-1) + A[n-2]*C(2,n-1) - A[n-3]*C(3,n-1) ...... A[1]*C(n-1,n... 阅读全文
posted @ 2014-09-03 05:07 LegendaryAC 阅读(130) 评论(0) 推荐(0)
HDU 3546
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3546题意:10个寄存器初值为1,有加乘赋值运算,最多30w次运算,大数最多5000位,问最后10个寄存器的结果题解:想直接暴力,但是会超时,30w*5000略多,关键优化是注意到如果出现赋值运算,则被赋值的寄存器... 阅读全文
posted @ 2014-08-11 04:45 LegendaryAC 阅读(251) 评论(0) 推荐(0)
高精度模板
摘要:#include #include #include #include #include using namespace std; #define MAXN 9999#define MAXSIZE 10#define DLEN 4class BigInt{ private: int a[50... 阅读全文
posted @ 2014-08-09 21:53 LegendaryAC 阅读(137) 评论(0) 推荐(0)
HDU 1402
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1402fft做O(nlog(n))大数乘法,kuangbin的模板#include #include #include #include #include using namespace std;const dou... 阅读全文
posted @ 2014-04-16 21:56 LegendaryAC 阅读(183) 评论(0) 推荐(0)
HDU 1865 1sting
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1865大数的斐波那契数列,又用java猥琐过了。。。View Code import java.io.* ;import java.math.* ;import java.util.* ;import java.text.* ;public class Main{ public static void main(String[]args) { Scanner cin=new Scanner(new BufferedInputStream(System.in)) ; Bi... 阅读全文
posted @ 2012-06-06 22:53 LegendaryAC 阅读(176) 评论(0) 推荐(0)
HDU 1316 How Many Fibs?
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1316大数,斐波那契数列View Code import java.io.*;import java.math.*;import java.util.*;import java.text.*;public class Main{ public static void main(String[]args) { Scanner cin=new Scanner (new BufferedInputStream(System.in)); BigInteger a,b; ... 阅读全文
posted @ 2012-05-28 15:45 LegendaryAC 阅读(185) 评论(0) 推荐(0)
HDU 1063 Exponentiation
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1063依然是高精度,和上一题很像,不过用上一题的方法一直超时?颇为费解。查了几个函数的用法,直接用函数操作就不超时了?这题mark一下以后还要再看,对超时表示不太理解。stripTrailingZeros()是去掉后缀0,toPlainString()是转成非指数型的字符串(上一题要知道这两个函数直接秒杀了哈。。。)。startsWith("//字符串1")判断给定字符串是否以字符串1开头(对应的还有endsWith())。substring()的用法参考百度百科,看一眼就明白了:&quo 阅读全文
posted @ 2012-05-21 11:38 LegendaryAC 阅读(145) 评论(0) 推荐(0)
HDU 1753 大明A+B
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1753在小数点存在的情况下去掉后面的0View Code import java.io.*;import java.math.*;import java.util.*;import java.text.*;public class Main{ public static void main(String[] args) { Scanner cin=new Scanner (new BufferedInputStream(System.in)); BigDecimal a... 阅读全文
posted @ 2012-05-21 10:38 LegendaryAC 阅读(156) 评论(0) 推荐(0)
HDU 1047 Integer Inquiry
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1047大数View Code import java.io.*;import java.math.*;import java.util.*;import java.text.*;public class Main{ public static void main(String[] args) { Scanner cin=new Scanner (new BufferedInputStream(System.in)); BigInteger sum,a; i... 阅读全文
posted @ 2012-05-21 10:09 LegendaryAC 阅读(116) 评论(0) 推荐(0)
HDU 1134 Game of Connections
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1134在上一题的基础上加个-1跳出的判断、、、View Code import java.io.*;import java.math.*;import java.util.*;import java.text.*;public class Main{ public static void main(String[] args) { Scanner cin=new Scanner (new BufferedInputStream(System.in)); BigInteg... 阅读全文
posted @ 2012-05-20 23:53 LegendaryAC 阅读(201) 评论(0) 推荐(0)
HDU 1130 How Many Trees?
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1130和上一题一模一样View Code import java.io.*;import java.math.*;import java.util.*;import java.text.*;public class Main{ public static void main(String[] args) { Scanner cin=new Scanner (new BufferedInputStream(System.in)); BigInteger[] f=new B... 阅读全文
posted @ 2012-05-20 23:43 LegendaryAC 阅读(333) 评论(0) 推荐(0)
HDU 1023 Train Problem II
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1023卡特兰数,要注意是大数,直接学着用java搞大数了View Code import java.io.*;import java.math.*;import java.util.*;import java.text.*;public class Main{ public static void main(String[] args) { Scanner cin=new Scanner (new BufferedInputStream(System.in)); Big... 阅读全文
posted @ 2012-05-20 23:40 LegendaryAC 阅读(164) 评论(0) 推荐(0)