求高手解决一下,无法通过,不知道为啥
查看原帖
求高手解决一下,无法通过,不知道为啥
783615
Qiyu111楼主2024/3/11 21:06
import java.util.*;

public class Smoke {
        public static void main(String[] agr){
            Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int k = sc.nextInt();
            int divisor = n/k;
            int remainder = n%k;
            int sum =0;
            int total = 0;
            while (divisor > 0){
                total = total + divisor;
                sum = divisor + remainder;
                divisor = sum/k;
                remainder = sum%k;
            }
            total=total + n;
            System.out.println(total);
        }
}
2024/3/11 21:06
加载中...