結果

問題 No.111 あばばばば
ユーザー matsuyoshi30
提出日時 2016-02-05 20:22:21
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 356 bytes
コンパイル時間 2,152 ms
コンパイル使用メモリ 74,036 KB
実行使用メモリ 835,404 KB
最終ジャッジ日時 2024-09-21 20:38:55
合計ジャッジ時間 5,527 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 3 MLE * 1 -- * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
L3 = 1
Ln = Ln-1 + n - 2
 */

import java.util.Scanner;

class Test {
	public static int aba(int n) {
		if(n == 3) {
			return 1;
		} else {
			return aba(n-1) + n - 2;
		}
	}

	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(System.in);
		int l = in.nextInt();

		int ans = aba(l);

		System.out.println(ans);
	}
}
0