結果

問題 No.371 ぼく悪いプライムじゃないよ
ユーザー mbanmban
提出日時 2017-04-12 16:15:43
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,188 bytes
コンパイル時間 2,303 ms
コンパイル使用メモリ 101,628 KB
実行使用メモリ 22,808 KB
最終ジャッジ日時 2023-09-25 13:05:17
合計ジャッジ時間 7,285 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,732 KB
testcase_01 AC 57 ms
18,740 KB
testcase_02 AC 57 ms
20,668 KB
testcase_03 AC 58 ms
20,760 KB
testcase_04 AC 57 ms
22,648 KB
testcase_05 AC 59 ms
20,644 KB
testcase_06 AC 58 ms
22,768 KB
testcase_07 AC 57 ms
20,704 KB
testcase_08 AC 57 ms
22,808 KB
testcase_09 AC 58 ms
20,760 KB
testcase_10 AC 59 ms
22,776 KB
testcase_11 AC 58 ms
22,728 KB
testcase_12 AC 58 ms
20,676 KB
testcase_13 AC 58 ms
20,728 KB
testcase_14 AC 57 ms
20,708 KB
testcase_15 AC 58 ms
20,724 KB
testcase_16 AC 58 ms
22,792 KB
testcase_17 AC 58 ms
20,760 KB
testcase_18 AC 58 ms
22,716 KB
testcase_19 AC 60 ms
20,772 KB
testcase_20 AC 58 ms
22,704 KB
testcase_21 AC 58 ms
20,728 KB
testcase_22 AC 60 ms
22,716 KB
testcase_23 AC 60 ms
18,836 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;

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

public class Magatro
{
    private int H, L;

    private void Scan()
    {
        string[] s = Console.ReadLine().Split(' ');
        H = int.Parse(s[1]);
        L = int.Parse(s[0]);
    }

    public void Solve()
    {
        Scan();
        int iMax = (int)Math.Sqrt(H);
        long max = -1;
        long ans = -1 ;
        for (int j = iMax; j >= 2; j--)
        {
            if (max > j)
            {
                break;
            }
            for (int i = H / j; i >= j; i--)
            {
                if (i * j < L)
                {
                    break;
                }
                long l=(long)i * j;
                long p = Prime(l);
                if (max < p)
                {
                    max = p;
                    ans = l;
                }
            }
        }
        Console.WriteLine(ans);
    }

    private long Prime(long l)
    {
        for (long i = 2; i * i <= l; i++)
        {
            if (l % i == 0) return i;
        }
        return l;
    }
}
0