結果

問題 No.443 GCD of Permutation
ユーザー AreTrashAreTrash
提出日時 2018-05-23 19:15:18
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 683 bytes
コンパイル時間 2,317 ms
コンパイル使用メモリ 104,808 KB
実行使用メモリ 25,572 KB
最終ジャッジ日時 2023-09-11 01:49:08
合計ジャッジ時間 5,750 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 60 ms
21,676 KB
testcase_02 AC 58 ms
19,516 KB
testcase_03 AC 59 ms
21,508 KB
testcase_04 AC 59 ms
23,600 KB
testcase_05 AC 60 ms
21,716 KB
testcase_06 AC 59 ms
23,780 KB
testcase_07 AC 59 ms
21,612 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 59 ms
21,656 KB
testcase_11 WA -
testcase_12 AC 59 ms
21,708 KB
testcase_13 AC 59 ms
21,636 KB
testcase_14 AC 61 ms
21,508 KB
testcase_15 WA -
testcase_16 AC 61 ms
21,748 KB
testcase_17 AC 59 ms
19,544 KB
testcase_18 AC 61 ms
21,740 KB
testcase_19 AC 62 ms
21,768 KB
testcase_20 AC 61 ms
19,652 KB
testcase_21 AC 61 ms
21,716 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 63 ms
21,604 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 60 ms
21,476 KB
testcase_29 WA -
testcase_30 AC 64 ms
23,772 KB
testcase_31 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;

namespace No443
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var N = Console.ReadLine().Select(c => c - '0').Where(x => x != 0).ToArray();

            for (var i = 1; i <= 9; i++)
            {
                if (N.Any(x => x != i)) continue;
                Console.WriteLine(string.Join("", N));
                return;
            }

            var ans = 1;
            for (var sum = N.Sum(); sum % 3 == 0; sum /= 3) ans *= 3;
            if (N.All(x => x % 4 == 0)) ans *= 4;
            else if (N.All(x => x % 2 == 0)) ans *= 2;
            Console.WriteLine(ans);
        }
    }
}
0