0
Follow
0
View

Why does it run with eight blanks

huaxin445944 注册会员
2023-02-26 19:22

It feels like you should be asking the coin conversion question, with special attention to the loss of precision caused by double turning

        Scanner input = new Scanner(System.in);
        double a = input.nextDouble();
        long aLong = Math.round((a * 100));
        long b = aLong / 1000;
        long c = aLong % 1000 / 500;
        long d = aLong % 500 / 100;
        long f = aLong % 100 / 50;
        long j = aLong % 50 / 10;
        long h = aLong % 10 / 2;
        long i = aLong % 2;
        System.out.println(b + " 张十元");
        System.out.println(c + " 张五元");
        System.out.println(d + " 张一元");
        System.out.println(f + " 个五角");
        System.out.println(j + " 个一角");
        System.out.println(h + " 个贰分");
        System.out.print(i + " 个壹分");

About the Author

Question Info

Publish Time
2023-02-26 19:21
Update Time
2023-02-26 19:21

Related Question

麻烦各位大佬帮萌新解决一下unity遇到的问题

Unity2D敌人刚体粘在玩家身上

npm run build打包报错节点出错是什么原因啊?求解答!

Unity更改设置后疯狂报错

Unity3d-Xcharts

ESP32开发板运行报错 exit status 1 Error compiling for board ESP32 Dev Module.

veritas netbackup备份esxi主机问题点

如何测试函数与TcUnit在TwinCAT3?

Comptia security+

OpenCV报错 You can enable it via 'OPENCV_IO_ENABLE_OPENEXR'