結果
| 問題 |
No.821 Making Integers
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-27 12:25:44 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 2,000 ms |
| コード長 | 1,232 bytes |
| コンパイル時間 | 2,845 ms |
| コンパイル使用メモリ | 105,344 KB |
| 実行使用メモリ | 17,792 KB |
| 最終ジャッジ日時 | 2024-11-27 15:28:47 |
| 合計ジャッジ時間 | 2,281 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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); }
}
}