算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
JAVA 代码
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(),k = sc.nextInt();
int[] arr = new int[n+1];
int count = n;
int baoshu = 0;
while(true){
for(int i = 1;i<=n;i++){
if(arr[i] ==0){
baoshu++;
// 倍数
if((baoshu%k) == 0 || (baoshu%10) == k ){
arr[i] = i;
count--;
// System.out.println("---");
}
}
}
if(count == 1)break;
}
for(int i = 1;i<=n;i++){
if(arr[i] == 0){
System.out.println(i);
}
}
}
}