結果

問題 No.480 合計
ユーザー skylineskyline
提出日時 2020-02-01 12:49:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 403 bytes
コンパイル時間 2,184 ms
コンパイル使用メモリ 74,496 KB
実行使用メモリ 57,724 KB
最終ジャッジ日時 2023-10-18 23:54:35
合計ジャッジ時間 5,858 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
57,528 KB
testcase_01 AC 130 ms
57,444 KB
testcase_02 AC 133 ms
57,472 KB
testcase_03 AC 124 ms
56,284 KB
testcase_04 AC 134 ms
57,516 KB
testcase_05 AC 133 ms
57,632 KB
testcase_06 AC 132 ms
57,576 KB
testcase_07 AC 132 ms
57,568 KB
testcase_08 AC 130 ms
57,672 KB
testcase_09 AC 131 ms
57,588 KB
testcase_10 AC 132 ms
57,492 KB
testcase_11 AC 133 ms
57,380 KB
testcase_12 AC 132 ms
57,244 KB
testcase_13 AC 136 ms
57,460 KB
testcase_14 AC 132 ms
57,412 KB
testcase_15 AC 131 ms
57,668 KB
testcase_16 AC 132 ms
57,432 KB
testcase_17 AC 131 ms
57,464 KB
testcase_18 AC 131 ms
57,540 KB
testcase_19 AC 131 ms
57,460 KB
testcase_20 AC 131 ms
57,724 KB
testcase_21 AC 135 ms
57,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        String outStr = String.valueOf(sum(1, n));
        
        System.out.println(outStr);
        
    }
    
    public static int sum(int n1, int n2) {
        int result = (n1 + n2) * n2 / 2;
        return result;
    }
    
}
0