結果

問題 No.415 ぴょん
ユーザー wowilson
提出日時 2016-11-05 12:48:30
言語 C#(csc)
(csc 3.9.0)
結果
MLE  
実行時間 -
コード長 728 bytes
コンパイル時間 855 ms
コンパイル使用メモリ 107,152 KB
実行使用メモリ 790,092 KB
最終ジャッジ日時 2024-11-25 03:05:06
合計ジャッジ時間 9,988 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 RE * 4 TLE * 2 MLE * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace Yukicoder
{
    public class Program
    {
        public static void Main()
        {
            var line = Console.ReadLine().Split();
            int n = int.Parse(line[0]);
            int d = int.Parse(line[1]);

            int[] circle = new int[n];
            int cur = 0;
            int cnt = 0;
            circle[0] = -1;

            while (true)
            {
                cur += d;
                cur %= n;
                if (circle[cur] == 0)
                {
                    cnt++;
                    circle[cur] = -1;
                }else
                {
                    break;
                }
            }
            Console.WriteLine(cnt);
        }
    }
}

0