package poj1664;
来源:互联网 发布:淘宝拍单送礼品群 编辑:程序博客网 时间:2024/05/06 04:05
import java.util.Scanner;
public class Sttt {
public static int[] res=new int[20];
public static int respc=0;
public static int[][] temp=new int[11][11];
public static int f(int m,int n) {
if(m<0)
return 0;
if(m==0||n==1)
return 1;
if(temp[m][n]!=0){
return temp[m][n];
}else{
temp[m][n]=f(m-n,n)+f(m,n-1);
}
return temp[m][n];
}
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int tnum=sc.nextInt();
int nnum=tnum;
while(tnum-->0){
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
temp[i][j]=0;
}
}
int m=sc.nextInt();
int n=sc.nextInt();
res[respc++]=f(m,n);
}
for(int i=0;i<nnum;i++){
System.out.println(res[i]);
}
}
}
- package poj1664;
- poj1664
- POJ1664
- poj1664
- poj1664
- POJ1664
- poj1664
- poj1664
- 1poj1664
- poj1664 DFS
- Poj1664!【递归】
- poj1664【DFS】
- poj1664-1
- poj1664解题报告
- 整数划分问题 POJ1664
- POJ1664 放苹果
- poj1664放苹果
- POJ1664 放苹果 递归
- 3分钟学会sessionStorage用法
- 正在加载4
- Python学习之mac下PyCharm导入第三方包
- 正在加载5
- spark中的RDD
- package poj1664;
- Code signing is required for product type 'Application' in SDK 'iOS 10.1'
- 正在加载6
- DataGridView取消点击列标题排序
- 正在加载7
- 排序算法--插入排序之直接插入排序
- 正在加载8
- package poj1979;
- Mac OS X 启用 Web 服务器