1
リニア整数配列のインクリメントを増やすためにinterval parse intを実装する方法を教えてください。 もがJava実装のインターバル解析int
public class Sequence {
/*Generate an array representing a linear sequence of N values specified by the start value and the interval example,interval(6, 2, 3) would produce {2,5,8,11,14,17}*/
public int[] Linear(int N, int start, int interval){
int interval = Integer.parseInt(args[0]);
for (int i = 1; i<= N; i++);
i = i + interval;
}
//Generate an array of the first N values of the Fibonacci sequence (1,1,2,3,5,8,13,21,...). Assume N > 2
public static int[] fibonacci(int N){
int[] fibo = new int [N + 1];
fibo[0] = 1;
fibo[1] = 1;
for (int i = 2; i<= N; i++)
fibo[i]= fibo[i-1] + fibo[i-2];
// int[] x = fibo;
return fibo;
}
public static void main(String[] args) {
int N = Integer.parseInt(args[0]);
//fibonacci(N);
for (int i = 1; i <= N; i++)
System.out.println(fibonacci(i));
}
}
? – LppEdd