結果
問題 | No.821 Making Integers |
ユーザー |
|
提出日時 | 2019-04-26 22:38:56 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 122 ms / 2,000 ms |
コード長 | 666 bytes |
コンパイル時間 | 2,953 ms |
コンパイル使用メモリ | 74,816 KB |
実行使用メモリ | 53,908 KB |
最終ジャッジ日時 | 2024-11-25 05:15:41 |
合計ジャッジ時間 | 4,589 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 |
ソースコード
import java.io.*; import java.util.Scanner; public class Main_yukicoder821 { private static Scanner sc; private static Printer pr; private static void solve() { long n = sc.nextInt(); long k = sc.nextInt(); long max = n * (n + 1) / 2; long min = n * (n + 1) / 2 - (n - k) * (n - k + 1) / 2 * 2; pr.println((max + min + 1 + 1) / 2) ; } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } static class Printer extends PrintWriter { Printer(OutputStream out) { super(out); } } }