結果

問題 No.141 魔法少女コバ
ユーザー mban
提出日時 2017-01-12 15:40:06
言語 C#
(mono 5.2.0)
結果
AC  
実行時間 38 ms
コード長 1862 Byte
コンパイル時間 308 ms
使用メモリ 18668 KB

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
challenge01.txt AC 29 ms
16620 KB
challenge02.txt AC 28 ms
18668 KB
challenge03.txt AC 28 ms
14568 KB
testcase-0.txt AC 28 ms
16616 KB
testcase-1.txt AC 28 ms
18664 KB
testcase-2.txt AC 26 ms
14576 KB
testcase-3.txt AC 28 ms
16628 KB
testcase-4.txt AC 27 ms
14568 KB
testcase-5.txt AC 27 ms
14576 KB
testcase-6.txt AC 28 ms
16620 KB
testcase-7.txt AC 31 ms
16620 KB
testcase-8.txt AC 38 ms
16616 KB
testcase-9.txt AC 30 ms
16620 KB
testcase-10.txt AC 30 ms
16612 KB
testcase-11.txt AC 28 ms
16616 KB
testcase-12.txt AC 28 ms
16616 KB
testcase-13.txt AC 30 ms
18668 KB
testcase-14.txt AC 28 ms
16612 KB
testcase-15.txt AC 27 ms
16620 KB
testcase-16.txt AC 26 ms
14568 KB
testcase-17.txt AC 28 ms
14580 KB
testcase-18.txt AC 27 ms
16616 KB
testcase-19.txt AC 27 ms
16620 KB
testcase-20.txt AC 27 ms
14576 KB
testcase-21.txt AC 27 ms
16624 KB
testcase-22.txt AC 27 ms
14576 KB
testcase-23.txt AC 28 ms
14580 KB
testcase-24.txt AC 28 ms
14576 KB
testcase-25.txt AC 28 ms
16612 KB
testcase-26.txt AC 27 ms
16628 KB
testcase-27.txt AC 29 ms
16616 KB
testcase-28.txt AC 27 ms
16616 KB
testcase-29.txt AC 29 ms
16624 KB
testcase-30.txt AC 28 ms
16628 KB
testcase-31.txt AC 27 ms
14580 KB
testcase-32.txt AC 32 ms
16620 KB
testcase-33.txt AC 28 ms
16620 KB
testcase-34.txt AC 28 ms
14588 KB
testcase-35.txt AC 27 ms
14580 KB
testcase-36.txt AC 27 ms
16620 KB
testcase-37.txt AC 27 ms
16616 KB
testcase-38.txt AC 29 ms
18664 KB
testcase-39.txt AC 27 ms
16624 KB
testcase-40.txt AC 28 ms
18664 KB
testcase-41.txt AC 28 ms
18664 KB
testcase-42.txt AC 31 ms
14572 KB
testcase-43.txt AC 27 ms
14572 KB
testcase-44.txt AC 28 ms
16620 KB
testcase-45.txt AC 26 ms
14572 KB
testcase-46.txt AC 28 ms
16616 KB
testcase-47.txt AC 28 ms
18668 KB
testcase-48.txt AC 27 ms
14580 KB
testcase-49.txt AC 27 ms
14576 KB
testcase-50.txt AC 28 ms
16616 KB
testcase-51.txt AC 28 ms
16616 KB
testcase-52.txt AC 28 ms
14572 KB
testcase-53.txt AC 28 ms
16620 KB
testcase-54.txt AC 30 ms
18664 KB
testcase-55.txt AC 27 ms
14568 KB
testcase-56.txt AC 27 ms
14584 KB
testcase-57.txt AC 28 ms
18664 KB
testcase-58.txt AC 27 ms
14572 KB
testcase-59.txt AC 28 ms
14572 KB
testcase-evil-0.txt AC 28 ms
14572 KB
testcase-evil-1.txt AC 28 ms
14584 KB
testcase-evil-2.txt AC 28 ms
18660 KB
testcase-evil-3.txt AC 27 ms
16616 KB
testcase-evil-4.txt AC 29 ms
18668 KB
testcase-evil-5.txt AC 28 ms
18668 KB
testcase-evil-6.txt AC 28 ms
16624 KB
testcase-evil-7.txt AC 28 ms
14568 KB
testcase-evil-8.txt AC 27 ms
14568 KB
testcase-evil-9.txt AC 28 ms
16628 KB
testcase-small-0.txt AC 27 ms
14564 KB
testcase-small-1.txt AC 27 ms
16616 KB
testcase-small-2.txt AC 27 ms
16624 KB
testcase-small-3.txt AC 25 ms
14572 KB
testcase-small-4.txt AC 28 ms
16616 KB
testcase-small-5.txt AC 26 ms
16612 KB
testcase-small-6.txt AC 27 ms
16608 KB
testcase-small-7.txt AC 27 ms
16616 KB
testcase-small-8.txt AC 28 ms
18664 KB
testcase-small-9.txt AC 27 ms
16616 KB
testcase-small-10.txt AC 25 ms
14576 KB
testcase-small-11.txt AC 27 ms
16612 KB
testcase-small-12.txt AC 27 ms
16612 KB
testcase-small-13.txt AC 25 ms
14572 KB
testcase-small-14.txt AC 28 ms
16620 KB
testcase-small-15.txt AC 28 ms
18664 KB
testcase-small-16.txt AC 27 ms
16616 KB
testcase-small-17.txt AC 26 ms
16616 KB
testcase-small-18.txt AC 27 ms
16624 KB
testcase-small-19.txt AC 31 ms
14580 KB
テストケース一括ダウンロード

ソースコード

diff #
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;

class Program
{
    static private Magatro M = new Magatro();
    static private void Main(string[]args)
    {
        M.Scan();
        M.Solve();
    }
}

public class Scanner
{
    private string[] S;
    private int Index;
    private char Separator;

    public Scanner(char separator = ' ')
    {
        Index = 0;
        Separator = separator;
    }

    private string[] Line()
    {
        return Console.ReadLine().Split(Separator);
    }

    public string Next()
    {
        string result;
        if (S == null || Index >= S.Length)
        {
            S = Line();
            Index = 0;
        }
        result = S[Index];
        Index++;
        return result;
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
}

public class Magatro
{
    private int M, N;
    public void Scan()
    {
        Scanner sc = new Scanner();
        M = sc.NextInt();
        N = sc.NextInt();
    }
    public void Solve()
    {
        int cnt = 0;
        while (M != N)
        {
            if (M < N)
            {
                Swap(ref M, ref N);
                cnt++;
            }
            else
            {
                cnt += M / N;
                M %= N;
                if (M == 0)
                {
                    cnt--;
                    break;
                }
            }
        }
        Console.WriteLine(cnt);
    }
    private void Swap(ref int a,ref int b)
    {
        int temp=a;
        a = b;
        b = temp;
    }
}
0