結果

問題 No.312 置換処理
ユーザー 14番14番
提出日時 2016-05-17 01:17:38
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,848 bytes
コンパイル時間 1,089 ms
コンパイル使用メモリ 108,288 KB
実行使用メモリ 19,200 KB
最終ジャッジ日時 2024-04-15 22:42:58
合計ジャッジ時間 3,291 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
18,816 KB
testcase_01 AC 36 ms
18,816 KB
testcase_02 AC 39 ms
18,944 KB
testcase_03 AC 39 ms
18,944 KB
testcase_04 AC 28 ms
18,944 KB
testcase_05 AC 28 ms
19,200 KB
testcase_06 AC 29 ms
19,072 KB
testcase_07 AC 31 ms
18,816 KB
testcase_08 AC 28 ms
18,816 KB
testcase_09 AC 28 ms
18,816 KB
testcase_10 AC 28 ms
18,688 KB
testcase_11 AC 29 ms
18,944 KB
testcase_12 AC 28 ms
18,944 KB
testcase_13 AC 28 ms
19,200 KB
testcase_14 AC 29 ms
18,688 KB
testcase_15 AC 29 ms
19,072 KB
testcase_16 AC 28 ms
18,688 KB
testcase_17 AC 30 ms
18,944 KB
testcase_18 AC 28 ms
18,688 KB
testcase_19 AC 28 ms
18,944 KB
testcase_20 AC 28 ms
18,944 KB
testcase_21 AC 28 ms
18,816 KB
testcase_22 AC 28 ms
18,944 KB
testcase_23 RE -
testcase_24 AC 28 ms
18,944 KB
testcase_25 AC 28 ms
19,072 KB
testcase_26 AC 28 ms
19,072 KB
testcase_27 RE -
testcase_28 AC 28 ms
18,816 KB
testcase_29 AC 28 ms
18,944 KB
testcase_30 AC 30 ms
19,072 KB
testcase_31 AC 30 ms
18,688 KB
testcase_32 AC 28 ms
18,944 KB
testcase_33 AC 33 ms
18,944 KB
testcase_34 AC 32 ms
19,072 KB
testcase_35 AC 29 ms
19,072 KB
testcase_36 AC 29 ms
18,944 KB
testcase_37 AC 28 ms
18,816 KB
testcase_38 AC 28 ms
18,944 KB
testcase_39 AC 28 ms
18,816 KB
testcase_40 AC 29 ms
18,816 KB
testcase_41 AC 29 ms
19,072 KB
testcase_42 AC 28 ms
18,816 KB
testcase_43 AC 28 ms
19,072 KB
testcase_44 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 num = long.Parse(Reader.ReadLine());
        Dictionary<long, long> tmp = this.CreateDic(num);
        long ans = num;
        if(tmp.ContainsKey(2) && tmp[2] >= 2) {
            ans = 4;
        }
        ans = Math.Min(ans, tmp.Keys.Where(a=>a>2).Min());
        Console.WriteLine(ans);
    }
    
    private Dictionary<long, long> CreateDic(long num) {
        long tmp = num;
        Dictionary<long, long> ret = new Dictionary<long, long>();
        for(long i=2; i*i<=num; i++) {
            while (tmp % i == 0)
            {
                if(ret.ContainsKey(i)) {
                    ret[i]++;
                } else {
                    ret.Add(i, 1);
                }
                if(i > 2) {
                    return ret;
                }
                tmp = tmp / i;
            }
            if(tmp == 1) {
                break;
            }
        }
        if(tmp > 1) {
            ret.Add(tmp, 1);
        }
        return ret;
        
    }
    
    
    


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



999999999989



 
";
        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