結果

問題 No.480 合計
ユーザー kashiwagi513kashiwagi513
提出日時 2019-02-19 21:26:15
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 373 bytes
コンパイル時間 1,986 ms
コンパイル使用メモリ 74,800 KB
実行使用メモリ 41,432 KB
最終ジャッジ日時 2024-04-20 22:09:20
合計ジャッジ時間 5,183 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
41,220 KB
testcase_01 AC 113 ms
41,112 KB
testcase_02 AC 115 ms
41,224 KB
testcase_03 AC 98 ms
40,012 KB
testcase_04 AC 98 ms
39,628 KB
testcase_05 AC 115 ms
41,144 KB
testcase_06 AC 103 ms
40,552 KB
testcase_07 AC 125 ms
40,864 KB
testcase_08 AC 122 ms
41,008 KB
testcase_09 AC 118 ms
41,160 KB
testcase_10 AC 117 ms
41,432 KB
testcase_11 AC 108 ms
40,716 KB
testcase_12 AC 113 ms
40,872 KB
testcase_13 AC 118 ms
41,140 KB
testcase_14 AC 116 ms
41,168 KB
testcase_15 AC 114 ms
41,320 KB
testcase_16 AC 115 ms
41,372 KB
testcase_17 AC 112 ms
41,204 KB
testcase_18 AC 97 ms
39,688 KB
testcase_19 AC 114 ms
40,964 KB
testcase_20 AC 115 ms
41,088 KB
testcase_21 AC 111 ms
41,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.lang.*;
import java.io.*;

class Main{
    public static int sum(int n, int acc) {
        if(n <= 0){return acc;}
        else{return sum(n-1, n+acc);}
    }
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        System.out.println(sum(n, 0));
    }
}
0