結果

問題 No.371 ぼく悪いプライムじゃないよ
ユーザー kuuso1kuuso1
提出日時 2016-05-14 00:37:40
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,626 bytes
コンパイル時間 2,017 ms
コンパイル使用メモリ 115,400 KB
実行使用メモリ 32,524 KB
最終ジャッジ日時 2024-04-15 18:03:59
合計ジャッジ時間 4,212 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
30,936 KB
testcase_01 AC 27 ms
24,120 KB
testcase_02 AC 27 ms
24,120 KB
testcase_03 AC 27 ms
26,036 KB
testcase_04 AC 27 ms
22,196 KB
testcase_05 AC 26 ms
24,124 KB
testcase_06 AC 27 ms
23,740 KB
testcase_07 AC 26 ms
23,864 KB
testcase_08 AC 25 ms
24,248 KB
testcase_09 AC 26 ms
23,992 KB
testcase_10 AC 28 ms
24,120 KB
testcase_11 AC 27 ms
24,248 KB
testcase_12 AC 27 ms
24,252 KB
testcase_13 AC 27 ms
21,956 KB
testcase_14 AC 27 ms
24,116 KB
testcase_15 AC 28 ms
23,984 KB
testcase_16 AC 27 ms
23,988 KB
testcase_17 AC 26 ms
23,992 KB
testcase_18 AC 26 ms
22,072 KB
testcase_19 AC 26 ms
24,120 KB
testcase_20 AC 96 ms
24,120 KB
testcase_21 AC 28 ms
24,132 KB
testcase_22 TLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int[] Er=new int[100000];
		Er[0]=Er[1]=1;
		for(int i=2;i<100000;i++){
			if(Er[i]==0)for(int j=i+i;j<100000;j+=i)Er[j]=1;
		}
		
		List<long> Prim=new List<long>();
		for(int i=0;i<100000;i++){
			if(Er[i]==0)Prim.Add((long)i);
		}
		
		long ans=0;
		for(int i=0;i<Prim.Count;i++){
			var p=Prim[i];
			for(long j=(H/p);(j>=2 && j*p>=L);j--){
				bool chk=true;
				for(int k=0;Prim[k]<p;k++){
					if(j%Prim[k]==0){
						chk=false;break;
					}
				}
				if(chk){
					ans=j*p;
					break;
				}
			}
		}
		Console.WriteLine(ans);
		
		
		
		
	}
	long L,H;
	public Sol(){
		var d=rla();
		L=d[0];H=d[1];
	}
	
	static bool IsPrime(long x){
		if(x<=1)return false;
		if(x==2)return true;
		for(long j=3;j*j<=x;j+=2){
			if(x%j==0)return false;
		}
		return true;
	}
	
	
	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
0