結果

問題 No.415 ぴょん
ユーザー 14番14番
提出日時 2016-08-26 23:20:14
言語 C#(csc)
(csc 3.9.0)
結果
MLE  
実行時間 -
コード長 1,321 bytes
コンパイル時間 2,995 ms
コンパイル使用メモリ 115,700 KB
実行使用メモリ 826,584 KB
最終ジャッジ日時 2024-04-25 21:48:54
合計ジャッジ時間 4,851 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
27,332 KB
testcase_01 AC 30 ms
23,088 KB
testcase_02 AC 30 ms
25,672 KB
testcase_03 MLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Text;
using System.Linq;



class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        long[] inpt = Reader.ReadLine().Split(' ').Select(a=>long.Parse(a)).ToArray();
        Dictionary<long, bool> dic = new Dictionary<long, bool>();

        long pos = 0;
        long ans = 0;
        dic.Add(0, true);
        for(long i=0; i<inpt[0]; i++) {
            pos = (pos + inpt[1]) % inpt[0];
            if(dic.ContainsKey(pos)) {
               break; 
            }
            dic.Add(pos, true);
            ans++;
        }
        Console.WriteLine(ans);
    }



    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"

5 2





";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0