結果

問題 No.821 Making Integers
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2019-04-26 22:00:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 312 bytes
コンパイル時間 2,931 ms
コンパイル使用メモリ 71,136 KB
実行使用メモリ 56,300 KB
最終ジャッジ日時 2023-08-16 14:14:26
合計ジャッジ時間 3,773 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,300 KB
testcase_01 AC 119 ms
56,064 KB
testcase_02 AC 116 ms
55,696 KB
testcase_03 AC 121 ms
55,880 KB
testcase_04 AC 118 ms
55,956 KB
testcase_05 AC 121 ms
55,952 KB
testcase_06 AC 117 ms
56,020 KB
testcase_07 AC 125 ms
55,612 KB
testcase_08 AC 123 ms
55,692 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