标签:java
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 25550 | Accepted: 16249 |
Description
Input
Output
Sample Input
1 7 3
Sample Output
8
Code:
<pre name="code" class="java">import java.util.Scanner; public class Main { public static int Test(int m, int n) { if (m == 0 || n == 1) { return 1; } if (n > m) { return Test(m, m); } else { return Test(m, n - 1) + Test(m - n, n); } } public static void main(String[] args) { Scanner cin = new Scanner(System.in); int i = cin.nextInt(); for (int j = 0; j < i; j++) { int m = cin.nextInt(); int n = cin.nextInt(); System.out.println(Test(m, n)); } cin.close(); } }
标签:java
原文地址:http://blog.csdn.net/tbk345/article/details/32229053