結果

問題 No.1140 EXPotentiaLLL!
ユーザー 👑 tatt61880tatt61880
提出日時 2021-02-23 18:32:11
言語 Kuin
(KuinC++ v.2021.9.17)
結果
WA  
実行時間 -
コード長 525 bytes
コンパイル時間 2,135 ms
コンパイル使用メモリ 149,652 KB
実行使用メモリ 8,508 KB
最終ジャッジ日時 2023-10-14 17:24:10
合計ジャッジ時間 12,699 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,038 ms
8,364 KB
testcase_01 AC 1,062 ms
8,256 KB
testcase_02 WA -
testcase_03 AC 781 ms
8,508 KB
testcase_04 AC 614 ms
8,432 KB
testcase_05 AC 940 ms
8,288 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 36 ms
8,192 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 36 ms
8,260 KB
権限があれば一括ダウンロードができます

ソースコード

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)
			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