結果

問題 No.276 連続する整数の和(1)
ユーザー GrenacheGrenache
提出日時 2015-09-04 22:28:17
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 344 bytes
コンパイル時間 3,979 ms
コンパイル使用メモリ 72,028 KB
実行使用メモリ 58,220 KB
最終ジャッジ日時 2023-09-26 04:36:27
合計ジャッジ時間 6,028 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,680 KB
testcase_01 AC 124 ms
55,660 KB
testcase_02 AC 121 ms
55,988 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder276 {

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

        long n = sc.nextLong();

        if (n == 1) {
        	System.out.println("1");
        } else {
        	System.out.println(n * (n - 1) / 2);
        }

        sc.close();
    }
}
0