結果
| 問題 |
No.371 ぼく悪いプライムじゃないよ
|
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2017-01-04 03:44:55 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,202 bytes |
| コンパイル時間 | 908 ms |
| コンパイル使用メモリ | 104,576 KB |
| 実行使用メモリ | 39,936 KB |
| 最終ジャッジ日時 | 2024-12-16 07:50:23 |
| 合計ジャッジ時間 | 49,929 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 WA * 1 TLE * 24 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
class Magatro
{
static void Main()
{
long L, H;
string[] s = Console.ReadLine().Split(' ');
L = long.Parse(s[0]);
H = long.Parse(s[1]);
long rootH = (int)Math.Sqrt(H);
long ans = 0;
long max=0;
for(long i = 2; i <= rootH; i++)
{
for(long j = i; j <= H / i; j++)
{
if (i * j < L)
{
continue;
}
long mins = Math.Min(MinSoinsu(i),MinSoinsu(j));
if (max <= mins)
{
max = mins;
ans = i * j;
}
}
}
Console.WriteLine(ans);
}
static long MinSoinsu(long n)
{
if (n % 2 == 0)
{
return 2;
}
for(int i = 3; i <= Math.Sqrt(n); i += 2)
{
if (n % i == 0)
{
return i;
}
}
return n;
}
}
mban