📄 q.java
字号:
/**
* @(#)Q.java
*
*
* @author
* @version 1.00 2008/10/22
*/
import java.util.Scanner;
public class Q {
/**
* Creates a new instance of <code>Q</code>.
*/
public static int Q(int n,int m) {
if(n<1)return 0;
if(m<1)return 0;
if(m==1)return 1;
if(n==1)return 1;
if(n<m)return Q(n,n);
if(n==m)return Q(n,m-1)+1;
return Q(n,m-1)+Q(n-m,m);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int n=0;
Scanner scan=new Scanner(System.in);
System.out.print("input n=");
n=scan.nextInt();
System.out.println("The Q is:"+Q(n,n));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -