結果

問題 No.3079 アルベド
ユーザー 👑 tatt61880tatt61880
提出日時 2021-04-01 23:18:06
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 604 bytes
コンパイル時間 2,398 ms
コンパイル使用メモリ 152,580 KB
実行使用メモリ 4,720 KB
最終ジャッジ日時 2023-10-14 18:13:39
合計ジャッジ時間 3,823 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
4,536 KB
testcase_01 AC 115 ms
4,372 KB
testcase_02 AC 71 ms
4,428 KB
testcase_03 AC 50 ms
4,372 KB
testcase_04 AC 92 ms
4,372 KB
testcase_05 AC 67 ms
4,624 KB
testcase_06 AC 86 ms
4,720 KB
testcase_07 AC 17 ms
4,484 KB
testcase_08 AC 24 ms
4,372 KB
testcase_09 AC 64 ms
4,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var nums: []int :: primeNums(100000)
	var t: int :: cui@inputInt()
	for(1, t)
		do cui@print("\{nums[cui@inputInt()]}\n")
	end for
	
	func primeNums(n: int): []int
		if(n < 2)
			ret[0].repeat(n + 1)
		end if
		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
		var res: []int :: #[n + 1]int
		for i(1, n)
			do res[i] :: res[i - 1] + (isPrime[i] ?(1, 0))
		end for
		ret res
	end func
end func
0