結果

問題 No.821 Making Integers
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2019-04-26 22:00:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 312 bytes
コンパイル時間 2,047 ms
コンパイル使用メモリ 74,220 KB
実行使用メモリ 54,448 KB
最終ジャッジ日時 2024-05-03 22:34:41
合計ジャッジ時間 3,833 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
54,448 KB
testcase_01 AC 116 ms
54,172 KB
testcase_02 AC 120 ms
53,884 KB
testcase_03 AC 126 ms
54,012 KB
testcase_04 AC 120 ms
53,704 KB
testcase_05 AC 117 ms
54,052 KB
testcase_06 AC 105 ms
53,008 KB
testcase_07 AC 115 ms
54,260 KB
testcase_08 AC 113 ms
54,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long k = sc.nextLong();
        long maxValue = (2*n-k+1) * k / 2 ;
        long ans = maxValue + 1;
        System.out.println(ans);
    }
}
0