萌新求助 为啥
  • 板块P1150 Peter 的烟
  • 楼主蓝色
  • 当前回复15
  • 已保存回复15
  • 发布时间2020/5/7 21:09
  • 上次更新2023/11/7 02:56:13
查看原帖
萌新求助 为啥
197853
蓝色楼主2020/5/7 21:09

第三个 WA 了,实在是搞不懂 90分

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int k = input.nextInt();
		int nNew = (int) (n / k);
		int more = n % k;

		int num = n + nNew;

		if (nNew >= k) {
			int nNewmore = (int) (nNew / k);
			num += nNewmore;
			more += nNewmore + nNew % k;
		}
		if (more >= k) {
			int moreMore = (int) (more / k);
			num += moreMore;
			more += moreMore + moreMore % k;
		}
		if (more < k) {
			System.out.println(num);
		}

	}
}
2020/5/7 21:09
加载中...