結果

問題 No.1389 Clumsy Calculation
ユーザー bluemeganebluemegane
提出日時 2021-02-13 07:36:11
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 680 bytes
コンパイル時間 1,455 ms
コンパイル使用メモリ 67,260 KB
実行使用メモリ 48,220 KB
最終ジャッジ日時 2023-09-27 14:49:08
合計ジャッジ時間 7,057 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
21,400 KB
testcase_01 AC 57 ms
19,308 KB
testcase_02 AC 57 ms
21,440 KB
testcase_03 RE -
testcase_04 AC 66 ms
23,760 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 59 ms
21,396 KB
testcase_09 RE -
testcase_10 AC 115 ms
35,116 KB
testcase_11 AC 66 ms
21,716 KB
testcase_12 AC 66 ms
21,856 KB
testcase_13 AC 66 ms
21,800 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

using System.Linq;
using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var X = int.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        getAns(n, X, a);
    }
    static void getAns(int n, int X, int[] a)
    {
        var asum = a.Sum();
        foreach (var x in a)
        {
            if (x % 2 == 0)
            {
                var w = asum - x / 2;
                if (w % (n - 1) == 0 && w / (n - 1) == X) { Console.WriteLine(x / 2); return; }
            }
        }
    }
}
0