大小货车运费java

有一批货物要货运,共n(0输入格式:
输入货物重量n公斤

输出格式:
一行分别输出小车和大车的各自数量以及总运费,以空格隔开。

输入样例:
在这里给出一组输入。例如:

3500
输出样例:
在这里给出相应的输出。例如:

1 2 490

这个就是用 if 判断下即可。

代码如下

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int bigNum = n / 1500;
        int left = n % 1500;
        int smallNum = left % 600 == 0 ? left / 600 : left / 600 + 1;
        int cost = 90 * smallNum + bigNum * 200;
        System.out.println(smallNum + " " + bigNum + " " + cost);

    }
}