結果
問題 | No.8079 アルベド |
ユーザー |
|
提出日時 | 2021-04-01 23:14:58 |
言語 | Kuin (KuinC++ v.2021.9.17) |
結果 |
AC
|
実行時間 | 91 ms / 2,000 ms |
コード長 | 649 bytes |
コンパイル時間 | 2,582 ms |
コンパイル使用メモリ | 145,764 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-16 12:20:53 |
合計ジャッジ時間 | 4,119 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
func main()const max: int :: 100000var isPrime: []bool :: sieve(max)var cum: []int :: #[max + 1]intfor i(1, max)do cum[i] :: cum[i - 1] + (isPrime[i] ?(1, 0))end forvar t: int :: cui@inputInt()for(1, t)var n: int :: cui@inputInt()do cui@print("\{cum[n]}\n")end forfunc sieve(n: int): []boolif(n < 2)ret[false].repeat(n + 1)end ifvar isPrime: []bool :: [true].repeat(n + 1)do isPrime[0] :: falsedo isPrime[1] :: falsefor i(2, n)if(isPrime[i])var j: int :: i * iwhile(j <= n)do isPrime[j] :: falsedo j :+ iend whileend ifend forret isPrimeend funcend func