問題の説明
知りたい少量の、以下の条件シーケンス満たす正の整数:
1.最初用語は、N-、
複数の第二のN-以下で2.;
3.各小さい最初の二つの差よりも、最初から第三の絶対値。
計算は、与えられたn個のために、どのように多くのシーケンスの条件を満たしています。
入力フォーマットの
入力ラインは、整数nを含んでいます。
出力フォーマット
出力解答を表す整数。答えは大きいかもしれない、回答出力は万で割ってください。
入力サンプル
4
出力例
7
実施例の説明
以下の条件を満足する配列である:
4 1
4 1 1
4 2 1
4 2
4 1 2
4 3
4 4
評価及び慣例スケールユースケース
例では20%の評価のために、1 <= N <= 5;
評価のユースケースの50%のために、1 <= N <= 10 ;
評価のユースケースの80%のために、1 <= N <= 100 ;
全てのレビューは、ケースを使用するために、1 <= N <= 1000 。
package 第十三次模拟;
import java.util.Scanner;
public class Demo8序列 {
public static int n=0,count=0;
public static int [] []map ;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
n =sc.nextInt();
sc.close();
map = new int [n+1][n+1];
for (int i = 1; i <=n; i++) {
map[i][i]=1;
map[i][0]=1;
map[0][i]=1;
}
for (int i = 1; i <=n; i++) {
count+=f(n,i);
// System.out.println(count);
}
System.out.println(count);
// System.out.println(f(4,2));
}
public static int f(int x,int y){
if(map[x][y]!=0){
return map[x][y];
}
for (int i = Math.abs(x-y)-1; i>=0; i--) {
map[x][y]+=f(y,i);
}
map[y][x]=map[x][y];
return map[x][y];
}
}