フィボナッチメソッドのパフォーマンスを向上させるためにキャッシュを利用しようとしています。しかし、フィボナッチでさえも計算するのにまだまだ時間がかかります(40)。 import java.util.Scanner;
public class FibWithCache {
public static void main(String args[]) {
System.ou
配列内の隣接していない要素の最大合計を求めるアルゴリズムを考え出しましたが、合計のために選んだ。ここでは(いくつかの初期化なし)最大合計のための私のアルゴリズムは次のとおりです。 int n; //number of cells. Cells are labeled from 1 to n
int num[]; // all the numbers
int findMax[]; // find