結果

問題 No.693 square1001 and Permutation 2
ユーザー _matumo__matumo_
提出日時 2018-07-18 22:44:11
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 4,744 ms
コンパイル使用メモリ 103,116 KB
実行使用メモリ 23,812 KB
最終ジャッジ日時 2023-08-22 13:03:17
合計ジャッジ時間 6,427 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
21,756 KB
testcase_01 AC 64 ms
21,612 KB
testcase_02 AC 65 ms
23,752 KB
testcase_03 AC 65 ms
23,652 KB
testcase_04 AC 65 ms
23,812 KB
testcase_05 AC 63 ms
21,744 KB
testcase_06 AC 64 ms
21,668 KB
testcase_07 AC 64 ms
23,748 KB
testcase_08 AC 64 ms
21,696 KB
testcase_09 AC 64 ms
21,700 KB
testcase_10 AC 64 ms
21,620 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace YukiCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            var nSum = Console.ReadLine().Split().Select(int.Parse).OrderBy(x=>x).Select((n,i)=>n<i+1?i+1-n:n-i-1).Sum();
            Console.WriteLine(nSum);
            Console.ReadLine();
        }
    }
}
0