結果

問題 No.1083 余りの余り
ユーザー Yusei KatoYusei Kato
提出日時 2020-06-22 21:15:47
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 61 ms / 3,000 ms
コード長 1,500 bytes
コンパイル時間 1,173 ms
コンパイル使用メモリ 68,040 KB
実行使用メモリ 24,096 KB
最終ジャッジ日時 2023-09-16 19:27:00
合計ジャッジ時間 4,490 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
19,868 KB
testcase_01 AC 60 ms
19,720 KB
testcase_02 AC 60 ms
23,900 KB
testcase_03 AC 60 ms
23,984 KB
testcase_04 AC 59 ms
21,816 KB
testcase_05 AC 60 ms
23,916 KB
testcase_06 AC 60 ms
21,800 KB
testcase_07 AC 59 ms
19,864 KB
testcase_08 AC 59 ms
21,912 KB
testcase_09 AC 56 ms
21,968 KB
testcase_10 AC 59 ms
23,932 KB
testcase_11 AC 58 ms
21,944 KB
testcase_12 AC 58 ms
21,912 KB
testcase_13 AC 60 ms
21,840 KB
testcase_14 AC 58 ms
21,772 KB
testcase_15 AC 58 ms
23,920 KB
testcase_16 AC 57 ms
23,852 KB
testcase_17 AC 60 ms
24,096 KB
testcase_18 AC 58 ms
19,864 KB
testcase_19 AC 59 ms
21,864 KB
testcase_20 AC 59 ms
21,844 KB
testcase_21 AC 59 ms
19,780 KB
testcase_22 AC 61 ms
21,820 KB
testcase_23 AC 60 ms
23,868 KB
testcase_24 AC 58 ms
21,828 KB
testcase_25 AC 59 ms
24,036 KB
testcase_26 AC 59 ms
21,832 KB
testcase_27 AC 60 ms
23,996 KB
testcase_28 AC 60 ms
23,932 KB
testcase_29 AC 59 ms
21,908 KB
testcase_30 AC 59 ms
19,828 KB
testcase_31 AC 59 ms
21,856 KB
testcase_32 AC 59 ms
23,964 KB
testcase_33 AC 60 ms
21,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

namespace Problem1083
{
    class Program
    {
        static void Main(string[] args)
        {
            var buff = GetLongArray();
            long K = buff[1];
            var A = GetLongList();

            Console.WriteLine(Solver(K, A));

        }

        static long Solver (long k, List<long> list)
        {
            if (list.FindIndex(x => x <= k) == -1)
            {
                return k;
            }
            else
            {
                long temp = 0;
                long max = 0;
                for(int i = 0; i < list.Count; i++)
                {
                    if(list[i] <= k)
                    {
                        temp = Solver(k % list[i], list);
                        max = max < temp ? temp : max;
                    }
                }
                return max;
            }
        }

        public static int GetInt() => int.Parse(Console.ReadLine());
        public static int[] GetIntArray() => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static double GetDouble() => double.Parse(Console.ReadLine());
        public static double[] GetDoubleArray() => Console.ReadLine().Split().Select(double.Parse).ToArray();
        public static List<long> GetLongList() => Console.ReadLine().Split().Select(long.Parse).ToList();
        public static long[] GetLongArray() => Console.ReadLine().Split().Select(long.Parse).ToArray();

    }
}
0