package test;
/**
*
* @author ChenYeKe
*/
class Node {
Object item;
Node next;
Node(Object v) {
item = v;
next = null;
}
}
public class Test {
public static void main(String[] args) {
}
static int fancorial(int N)//阶乘函数
{
if (N == 0) {
return 1;
}
return N * fancorial(N - 1);
}
static int gcd(int M, int N) {
if (N == 0) {
return M;
}
return gcd(N, M % N);
}
static char[] a;
static int i;
static int eval()//前缀表达式求值
{
int x = 0;
while (a[i] == ' ') {
i++;
}
if (a[i] == '+') {
i++;
return eval() + eval();
}
if (a[i] == '-') {
i++;
return eval() - eval();
}
if (a[i] == '*') {
i++;
return eval() * eval();
}
if (a[i] == '/') {
i++;
return eval() / eval();
}
while ((a[i] >= '0') && (a[i] <= '9')) {
x = x * 10 + (a[i++] - '0');
}
return x;
}
static double max(double a[], int l, int r) {//二分查找
if (l == r) {
return a[l];
}
int m = (l + r) / 2;
double u = max(a, l, m);
double v = max(a, m + l, r);
if (u > v) {
return u;
} else {
return v;
}
}
static final int maxN=47;
static int knowF[]=new int [manN];
static int F(int i)
{
if(knowF[i]!=0) return knowF[i];
int t=i;
if(i<0)
return 0;
if(i>1)
t=F(i-1)+F(i-2);
return knowF[i]=t;
}
}
未完成
最新推荐文章于 2022-06-22 09:52:11 发布