結果

問題 No.821 Making Integers
ユーザー Tomohiko HasegawaTomohiko Hasegawa
提出日時 2019-04-27 12:25:44
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 1,232 bytes
コンパイル時間 1,554 ms
コンパイル使用メモリ 65,172 KB
実行使用メモリ 22,840 KB
最終ジャッジ日時 2023-08-18 11:09:06
合計ジャッジ時間 3,025 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
20,692 KB
testcase_01 AC 54 ms
20,816 KB
testcase_02 AC 53 ms
20,680 KB
testcase_03 AC 54 ms
22,840 KB
testcase_04 AC 52 ms
22,784 KB
testcase_05 AC 54 ms
20,696 KB
testcase_06 AC 55 ms
20,680 KB
testcase_07 AC 56 ms
20,800 KB
testcase_08 AC 53 ms
20,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.yukicoder
{
    class _821
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            long[] nk = ReadLongs();
            long n = nk[0];
            long k = nk[1];
            long res = n * (n + 1) / 2;
            res -= (n - k) * (n - k + 1) / 2;
            WriteLine(res + 1);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}
0