結果

問題 No.3079 アルベド
ユーザー 👑 tatt61880tatt61880
提出日時 2021-08-11 19:59:52
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 530 bytes
コンパイル時間 4,359 ms
コンパイル使用メモリ 146,944 KB
実行使用メモリ 5,104 KB
最終ジャッジ日時 2023-10-25 22:06:01
合計ジャッジ時間 6,013 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
5,104 KB
testcase_01 AC 98 ms
5,104 KB
testcase_02 AC 61 ms
5,104 KB
testcase_03 AC 42 ms
5,104 KB
testcase_04 AC 77 ms
5,104 KB
testcase_05 AC 57 ms
5,104 KB
testcase_06 AC 70 ms
5,104 KB
testcase_07 AC 13 ms
5,104 KB
testcase_08 AC 19 ms
5,104 KB
testcase_09 AC 54 ms
5,104 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
end func

func primeNums(n: int): []int
	if(n < 2)
		ret [0].repeat(n + 1)
	end if
	var isPrime: []int :: [0, 0] ~ [1].repeat(n - 1)
	for i(2, n)
		if(isPrime[i] = 1)
			var j: int :: i * i
			while(j <= n)
				do isPrime[j] :: 0
				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]
	end for
	ret res
end func
0