結果

問題 No.136 Yet Another GCD Problem
ユーザー mban
提出日時 2017-01-12 15:47:03
言語 C#
(mono 4.8.0)
結果
AC  
実行時間 32 ms
コード長 1531 Byte
コンパイル時間 313 ms
使用メモリ 18656 KB

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
sample1.txt AC 26 ms
16612 KB
sample2.txt AC 28 ms
16608 KB
sample3.txt AC 29 ms
16620 KB
system_test1.txt AC 28 ms
16612 KB
system_test2.txt AC 27 ms
16616 KB
system_test3.txt AC 27 ms
14576 KB
system_test4.txt AC 27 ms
14564 KB
system_test5.txt AC 28 ms
14576 KB
system_test6.txt AC 27 ms
16612 KB
system_test7.txt AC 28 ms
16616 KB
system_test8.txt AC 29 ms
16616 KB
system_test9.txt AC 29 ms
16612 KB
system_test10.txt AC 27 ms
16612 KB
system_test11.txt AC 29 ms
16612 KB
system_test12.txt AC 30 ms
16612 KB
system_test13.txt AC 32 ms
16620 KB
system_test14.txt AC 28 ms
16616 KB
system_test15.txt AC 31 ms
14560 KB
yagcd_1_1.txt AC 30 ms
14576 KB
yagcd_1_2.txt AC 29 ms
16620 KB
yagcd_1_3.txt AC 28 ms
14580 KB
yagcd_1_4.txt AC 27 ms
16616 KB
yagcd_2_1.txt AC 27 ms
16616 KB
yagcd_2_2.txt AC 27 ms
16612 KB
yagcd_2_3.txt AC 29 ms
14564 KB
yagcd_2_4.txt AC 28 ms
18656 KB
yagcd_3_1.txt AC 29 ms
16608 KB
yagcd_3_2.txt AC 30 ms
16616 KB
yagcd_3_3.txt AC 30 ms
16612 KB
yagcd_3_4.txt AC 28 ms
14560 KB
yagcd_4_1.txt AC 29 ms
14568 KB
yagcd_4_2.txt AC 27 ms
16612 KB
yagcd_4_3.txt AC 27 ms
16616 KB
yagcd_4_4.txt AC 30 ms
16612 KB
yagcd_5_1.txt AC 27 ms
14568 KB
yagcd_5_2.txt AC 29 ms
16616 KB
yagcd_5_3.txt AC 28 ms
16616 KB
yagcd_5_4.txt AC 27 ms
14580 KB
yagcd_6_1.txt AC 26 ms
14572 KB
yagcd_6_2.txt AC 27 ms
16608 KB
yagcd_6_3.txt AC 28 ms
16616 KB
yagcd_6_4.txt AC 27 ms
14576 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 N, K;
    public void Scan()
    {
        Scanner sc = new Scanner();
        N = sc.NextInt();
        K = sc.NextInt();
    }
    public void Solve()
    {
        int ans = 0;
        for(int i = 1; i <= N / 2; i++)
        {
            if ((N - i) % i == 0)
            {
                ans = i;
            }
        }
        Console.WriteLine(ans);
    }
}
0