using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray(); this.MaxNum = inpt[0]; int primeCount = inpt[1]; this.PrimeList = GetPrimeList(this.MaxNum); GetAns(0, 1, primeCount); Console.WriteLine(Flag.Count()); } private int[] PrimeList; private int MaxNum; private Dictionary Flag = new Dictionary(); private void GetAns(int idx, int subTotal, int remain) { if(subTotal > MaxNum) { return; } if(remain == 0) { for (long i = 1; i * subTotal <= MaxNum; i++) { Flag[(int)(i * subTotal)] = true; } return; } if(idx>=this.PrimeList.Length) { return; } for (int i = idx; i < PrimeList.Length; i++) { long tmp = 1; tmp = tmp * subTotal; tmp = tmp * PrimeList[i]; if(tmp>MaxNum||tmp<=0) { return; } GetAns(i + 1, subTotal * PrimeList[i], remain - 1); } } private int[] GetPrimeList(int max) { bool[] flags = new bool[max + 1]; List primeList = new List(); for (int i = 2; i <= max; i++) { if (flags[i]) { continue; } primeList.Add(i); int tmp = max / i; for (int j = 1; j <= tmp;j++) { flags[i * j] = true; } } return primeList.ToArray(); } public class Reader { private static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" 1000000 2 "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }