Created
June 2, 2021 01:51
-
-
Save sakapon/18b9cfaee864294c0d33ff51d4bde8c1 to your computer and use it in GitHub Desktop.
競プロ典型 90 問 / Q030
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
class Q030 | |
{ | |
static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse); | |
static (int, int) Read2() { var a = Read(); return (a[0], a[1]); } | |
static void Main() | |
{ | |
var (n, k) = Read2(); | |
Console.WriteLine(GetPrimeTypes(n).Count(x => x >= k)); | |
} | |
static int[] GetPrimeTypes(int n) | |
{ | |
var c = new int[n + 1]; | |
for (int p = 2; p <= n; ++p) | |
if (c[p] == 0) | |
for (int x = p; x <= n; x += p) | |
++c[x]; | |
return c; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://atcoder.jp/contests/typical90/submissions/23123147