社区讨论

java第一个和第五个WA卡住了,不知道哪里有问题

P5709【深基2.习6】Apples Prologue / 苹果和虫子参与者 2已保存回复 2

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
2 条
当前快照
1 份
快照标识符
@lo98mgds
此快照首次捕获于
2023/10/28 07:21
2 年前
此快照最后确认于
2023/10/28 07:21
2 年前
查看原帖
CPP
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner cin = new Scanner(System.in);
        int m = cin.nextInt();
        int t = cin.nextInt();
        int s = cin.nextInt();
        int n = 0;
        if(t == 0){
            System.out.println(n);
        }
        else {
            if (s % t == 0) {
                n = m - s / t;
            } else {
                n = m - s / t - 1;
            }
            System.out.println(n);
        }
    }

}

回复

2 条回复,欢迎继续交流。

正在加载回复...