結果

問題 No.443 GCD of Permutation
ユーザー AreTrash
提出日時 2018-05-23 19:15:18
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 683 bytes
コンパイル時間 895 ms
コンパイル使用メモリ 106,880 KB
実行使用メモリ 19,296 KB
最終ジャッジ日時 2024-06-28 16:19:32
合計ジャッジ時間 2,984 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16 WA * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
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