2 条题解
-
2
import java.util.Scanner; public class Main { public static void main(String[] args) { final Scanner scanner = new Scanner(System.in); //题目说将n定义为小朋友的数量,这里为了方便代码阅读将变量n重命名为amountOfCls,译为小朋友的数量 int amountOfCls = scanner.nextInt(), minimum = scanner.nextInt(), maximum = scanner.nextInt(), maximumReward = 0; for (int i = minimum; i <= maximum; i++) { int result = i % amountOfCls; if (result <= maximumReward) continue; maximumReward = result; } System.out.println(maximumReward); } }
- 1
信息
- ID
- 442
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 8
- 标签
- (无)
- 递交数
- 970
- 已通过
- 136
- 上传者