Uvaoj 11375 - Matches
来源:互联网 发布:男友尺寸知乎 编辑:程序博客网 时间:2024/06/05 03:03
题解:
递推+大数java
总结:
对于特殊情况要考虑清楚
import java.io.*;import java.util.*;import java.math.*;import java.text.*;public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner cin = new Scanner(System.in); final int MAXN = 2005; BigInteger [] d = new BigInteger[MAXN]; int c [] = {6,2,5,5,4,5,6,3,7,6}; for(int i = 0;i < MAXN;i++) d[i] = BigInteger.ZERO; d[0] = BigInteger.ONE; d[6] = BigInteger.valueOf(-1); for(int i = 0;i < MAXN;i++) { for(int j = 0;j < 10 && c[j] + i < MAXN;j++) { d[i + c[j]] = d[i + c[j]].add(d[i]); } } d[6] = d[6].add(BigInteger.ONE); d[0] = BigInteger.ZERO; for(int i = 1;i < MAXN;i++) d[i] = d[i].add(d[i - 1]); while(cin.hasNext()){ int n; n = cin.nextInt(); System.out.println(d[n]); } }}
0 0
- UVaOJ 11375 Matches
- Uvaoj 11375 - Matches
- UVaOJ
- Matches UVA 11375
- uva 11375 - Matches
- UVA 11375 - Matches
- UVA 11375 - Matches
- UVA - 11375 Matches
- UVa:11375 Matches
- UVa 11375 Matches
- UVa 11375 Matches
- Matches(uva 11375)
- matches()
- UVa 11375 Matches (DP&高精度)
- uva 11375 - Matches(递推)
- UVA - 11375-Matches-dp+高精度
- UVA 11375 Matches(递推)
- UVA 11375 Matches (dp+高精度)【模板】
- RecyclerView添加Header和Footer
- Centos7开放端口
- 一次干掉n个同一个服务启动的进程
- sql注入原理详解(一)
- ssh上传数据库+指定路径
- Uvaoj 11375 - Matches
- 【Git分布式版本控制系统】远程仓库管理
- MyEclipse快捷键
- 模板模式
- The connection to adb is down, and a severe error has occured之问题解决
- STL源码剖析 [特殊的空间配置器](内存基本处理工具stl_uninitialized.h)
- 搭建svn服务器
- iOS-UIMenuController 和 UIResponderStandardEditActions
- [工作笔记之二] 测试工作小结