結果

問題 No.141 魔法少女コバ
ユーザー mbanmban
提出日時 2017-01-12 15:40:06
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 59 ms / 5,000 ms
コード長 1,862 bytes
コンパイル時間 2,196 ms
コンパイル使用メモリ 105,008 KB
実行使用メモリ 22,840 KB
最終ジャッジ日時 2023-08-23 08:45:38
合計ジャッジ時間 11,342 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
20,660 KB
testcase_01 AC 58 ms
20,724 KB
testcase_02 AC 58 ms
20,812 KB
testcase_03 AC 58 ms
20,708 KB
testcase_04 AC 57 ms
20,720 KB
testcase_05 AC 58 ms
20,612 KB
testcase_06 AC 57 ms
20,660 KB
testcase_07 AC 58 ms
20,816 KB
testcase_08 AC 57 ms
18,656 KB
testcase_09 AC 58 ms
20,876 KB
testcase_10 AC 57 ms
20,652 KB
testcase_11 AC 56 ms
20,692 KB
testcase_12 AC 58 ms
20,868 KB
testcase_13 AC 57 ms
20,732 KB
testcase_14 AC 57 ms
20,800 KB
testcase_15 AC 58 ms
22,748 KB
testcase_16 AC 57 ms
20,700 KB
testcase_17 AC 57 ms
20,740 KB
testcase_18 AC 57 ms
20,688 KB
testcase_19 AC 58 ms
20,868 KB
testcase_20 AC 58 ms
20,816 KB
testcase_21 AC 58 ms
22,652 KB
testcase_22 AC 58 ms
22,720 KB
testcase_23 AC 58 ms
20,796 KB
testcase_24 AC 58 ms
20,708 KB
testcase_25 AC 58 ms
20,708 KB
testcase_26 AC 58 ms
20,788 KB
testcase_27 AC 58 ms
20,676 KB
testcase_28 AC 58 ms
22,772 KB
testcase_29 AC 57 ms
20,756 KB
testcase_30 AC 57 ms
20,692 KB
testcase_31 AC 57 ms
20,692 KB
testcase_32 AC 57 ms
20,668 KB
testcase_33 AC 57 ms
20,756 KB
testcase_34 AC 57 ms
20,804 KB
testcase_35 AC 58 ms
22,788 KB
testcase_36 AC 58 ms
22,828 KB
testcase_37 AC 57 ms
20,664 KB
testcase_38 AC 59 ms
22,700 KB
testcase_39 AC 57 ms
20,708 KB
testcase_40 AC 57 ms
20,648 KB
testcase_41 AC 58 ms
20,864 KB
testcase_42 AC 57 ms
20,828 KB
testcase_43 AC 56 ms
20,672 KB
testcase_44 AC 55 ms
20,744 KB
testcase_45 AC 58 ms
20,672 KB
testcase_46 AC 57 ms
20,664 KB
testcase_47 AC 57 ms
18,672 KB
testcase_48 AC 57 ms
22,728 KB
testcase_49 AC 57 ms
18,684 KB
testcase_50 AC 57 ms
20,704 KB
testcase_51 AC 58 ms
20,756 KB
testcase_52 AC 57 ms
20,768 KB
testcase_53 AC 58 ms
20,744 KB
testcase_54 AC 58 ms
22,772 KB
testcase_55 AC 57 ms
20,704 KB
testcase_56 AC 57 ms
18,756 KB
testcase_57 AC 57 ms
20,860 KB
testcase_58 AC 58 ms
20,872 KB
testcase_59 AC 58 ms
22,772 KB
testcase_60 AC 57 ms
20,620 KB
testcase_61 AC 58 ms
22,768 KB
testcase_62 AC 58 ms
20,684 KB
testcase_63 AC 57 ms
20,736 KB
testcase_64 AC 58 ms
20,712 KB
testcase_65 AC 57 ms
18,672 KB
testcase_66 AC 57 ms
20,668 KB
testcase_67 AC 57 ms
20,664 KB
testcase_68 AC 57 ms
18,636 KB
testcase_69 AC 56 ms
20,800 KB
testcase_70 AC 58 ms
22,780 KB
testcase_71 AC 58 ms
20,668 KB
testcase_72 AC 57 ms
20,800 KB
testcase_73 AC 57 ms
20,716 KB
testcase_74 AC 58 ms
22,664 KB
testcase_75 AC 58 ms
20,680 KB
testcase_76 AC 57 ms
22,756 KB
testcase_77 AC 57 ms
20,720 KB
testcase_78 AC 57 ms
20,692 KB
testcase_79 AC 57 ms
18,636 KB
testcase_80 AC 58 ms
22,840 KB
testcase_81 AC 57 ms
22,740 KB
testcase_82 AC 57 ms
20,776 KB
testcase-evil-0.txt AC 57 ms
20,804 KB
testcase-evil-1.txt AC 57 ms
20,668 KB
testcase-evil-2.txt AC 58 ms
20,868 KB
testcase-evil-3.txt AC 58 ms
22,760 KB
testcase-evil-4.txt AC 58 ms
22,776 KB
testcase-evil-5.txt AC 57 ms
20,728 KB
testcase-evil-6.txt AC 58 ms
22,700 KB
testcase-evil-7.txt AC 57 ms
20,712 KB
testcase-evil-8.txt AC 58 ms
20,680 KB
testcase-evil-9.txt AC 57 ms
20,748 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
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