結果

問題 No.371 ぼく悪いプライムじゃないよ
ユーザー mbanmban
提出日時 2017-04-12 16:27:36
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,303 bytes
コンパイル時間 2,173 ms
コンパイル使用メモリ 104,416 KB
実行使用メモリ 26,836 KB
最終ジャッジ日時 2023-09-25 13:05:52
合計ジャッジ時間 6,612 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,788 KB
testcase_01 AC 58 ms
22,704 KB
testcase_02 AC 57 ms
20,676 KB
testcase_03 WA -
testcase_04 AC 57 ms
22,644 KB
testcase_05 AC 58 ms
18,604 KB
testcase_06 AC 57 ms
20,708 KB
testcase_07 AC 58 ms
20,700 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 58 ms
22,740 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 58 ms
20,880 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 57 ms
18,620 KB
testcase_17 AC 57 ms
20,764 KB
testcase_18 AC 58 ms
20,744 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 59 ms
22,792 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 57 ms
22,716 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.Generic;
using System.Linq;

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

public class Magatro
{
    private long H, L;

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

    public void Solve()
    {
        Scan();
        int iMax = (int)Math.Sqrt(H);
        long max = -1;
        long ans = -1 ;
        for (int j = iMax+1; j >= 2; j--)
        {
            if (max > j)
            {
                break;
            }
            for (long i = H / j+1; i >= j; i--)
            {
                if (i * j < L)
                {
                    break;
                }
                if (i * j > H)
                {
                    continue;
                }
                long l=i * j;
                long p = Prime(l);
                if (max <= p)
                {
                    max = p;
                    ans = Math.Max(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