結果

問題 No.1140 EXPotentiaLLL!
ユーザー 👑 tatt61880tatt61880
提出日時 2021-02-23 18:31:24
言語 Kuin
(KuinC++ v.2021.9.17)
結果
RE  
実行時間 -
コード長 529 bytes
コンパイル時間 2,086 ms
コンパイル使用メモリ 149,408 KB
実行使用メモリ 8,636 KB
最終ジャッジ日時 2023-10-14 17:24:17
合計ジャッジ時間 5,445 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var primes: []bool :: sieve(5000000)
	func sieve(n: int): []bool
		var isPrime: []bool :: [true].repeat(n + 1)
		do isPrime[0] :: false
		do isPrime[1] :: false
		for i(2, n + 1)
			if(isPrime[i])
				var j: int :: i * i
				while(j <= n)
					do isPrime[j] :: false
					do j :+ i
				end while
			end if
		end for
		ret isPrime
	end func
	
	var t: int :: cui@inputInt()
	for(1, t)
		do cui@inputInt()
		var p: int :: cui@inputInt()
		var ans: int :: primes[p] ?(1, -1)
		do cui@print("\{ans}\n")
	end for
end func
0