CSP201709-1 打酱油

试题编号: 201709-1
试题名称: 打酱油
时间限制: 1.0s
内存限制: 256.0MB

import java.util.Scanner;
public class Main
{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        
        int fiveNum = 0,threeNum = 0;
        if(n >= 50){
            fiveNum = n/50; //分为fiveNum个50元
            n%=50;
        }
        if(n >= 30){
            threeNum = n/30;//分为threeNum个30元
            n%=30;
        }
        n/=10; //剩余的分为n个10元
        System.out.println(5*fiveNum+2*fiveNum + 3*threeNum + threeNum + n);
    }
}
 

猜你喜欢

转载自blog.csdn.net/qq_18287147/article/details/106940787
今日推荐