紧急求助

P1150 Peter 的烟

lntsyyds @ 2023-05-21 14:44:52

求助求助咋搞啊大佬们 第三个点WA了啊啊啊啊

import java.util.Scanner;

public class Main {
    static int sum=0;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int i = n / k;
        if (i<k){
            System.out.println((i+n));
        }else {
            sum = n;
            di(n, k);
            System.out.println(sum);
        }
    }
    public static void di(int n,int k) {
        int d1 = n / k;
        sum+=d1;
        if (d1 >= k) {
            di(d1, k);
        }
    }
}

by lntsyyds @ 2023-05-22 17:44:32

啊啊啊啊


|