結果

問題 No.2558 中国剰余定理
ユーザー aketijyuuzou
提出日時 2025-02-18 14:43:31
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 1,221 bytes
コンパイル時間 2,747 ms
コンパイル使用メモリ 108,416 KB
実行使用メモリ 19,712 KB
最終ジャッジ日時 2025-02-18 14:43:39
合計ジャッジ時間 5,111 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

// https://yukicoder.me/problems/no/2558
class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("3 5 1 2");
            //7
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("1 3000 0 0");
            //0
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("998 2443 5 3");
            //2203589
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        long[] wkArr = InputList[0].Split(' ').Select(pX => long.Parse(pX)).ToArray();
        long A = wkArr[0];
        long B = wkArr[1];
        long a = wkArr[2];
        long b = wkArr[3];

        for (long I = 0; I <= A * B; I++) {
            if (I % A == a && I % B == b) {
                Console.WriteLine(I);
                return;
            }
        }
    }
}

0