結果
問題 |
No.371 ぼく悪いプライムじゃないよ
|
ユーザー |
![]() |
提出日時 | 2017-01-04 03:29:31 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,172 bytes |
コンパイル時間 | 825 ms |
コンパイル使用メモリ | 103,808 KB |
実行使用メモリ | 34,688 KB |
最終ジャッジ日時 | 2024-12-16 07:49:31 |
合計ジャッジ時間 | 7,492 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 WA * 1 RE * 21 TLE * 2 |
コンパイルメッセージ
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() { int L, H; string[] s = Console.ReadLine().Split(' '); L = int.Parse(s[0]); H = int.Parse(s[1]); int rootH = (int)Math.Sqrt(H); int ans = 0; int max=0; for(int i = 2; i <= rootH; i++) { for(int j = i; j <= H / i; j++) { if (i * j < L) { continue; } int mins = MinSoinsu(i * j); if (max <= mins) { max = mins; ans = i * j; } } } Console.WriteLine(ans); } static int MinSoinsu(int 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; } }