P5709题目要求
P5709题目链接
有几个点注意下:
- 要取整,因为必须是完整的苹果
- 吃没了就结束,没有负数的情况
- 这题恶心的是可能吃一个苹果耗时为0,要特判防止RE
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int m = scanner.nextInt(), t = scanner.nextInt(), s = scanner.nextInt();
if (t == 0) {
System.out.println(0);
return;
}
int temp = (int) Math.ceil((double)s / t);
m -= temp;
if (m 4 && num
关注
打赏
热门博文
- 【Linux】Ubuntu20.04安装和卸载MySQL8
- 【Linux】Ubuntu 20.04 报错 curl: (23) Failure writing output to destination 的解决方法
- 【Java】JUnit 4.13.2 警告 ‘assertEquals(double, double)‘ is deprecated 的解决方法
- 【JavaScript】处理 @parcel/transformer-js: Browser scripts cannot have imports or exports.
- 【Node.js】Windows环境安装配置NVM和Node.js
- 【Python】处理TypeError: Plain typing.NoReturn is not valid as type argument
- 【Python】Matplotlib可视化50例
- 【C语言】C语言修改MySQL数据库
- 【Java】从默认包导入类和对象报错的解决方法
- 【Java】panel.getGraphics()报错空指针异常的解决方法