首页 > 其他分享 >Math.ceil,Math.round,Math.floor区别

Math.ceil,Math.round,Math.floor区别

时间:2023-04-22 11:56:26浏览次数:36  
标签:floor System ceil round Math out

Math.ceil,Math.round,Math.floor区别


//向上取整
System.out.println("amt1=" + Math.ceil(71.01));


//四舍五入
System.out.println("amt2=" + Math.round(71.01));


//向下取值,直接舍弃小数点
System.out.println("amt3=" + Math.floor(71.01));

输出结果:
amt1=72.0
amt2=71
amt3=71.0

 

标签:floor,System,ceil,round,Math,out
From: https://www.cnblogs.com/oktokeep/p/17342700.html

相关文章

  • Educational Codeforces Round 147 (Rated for Div. 2)
    EducationalCodeforcesRound147(RatedforDiv.2)链接EducationalCodeforcesRound147(RatedforDiv.2)A题如果第一位数是0,直接打印0如果第一位数是'?',有9个数可以选择,如果其他位数是'?',有10中情况选择,相乘就可以了#include<iostream>#include<algo......
  • meta seg_anything and grounding_dino
    https://github.com/IDEA-Research/GroundingDINOhttps://github.com/facebookresearch/segment-anything......
  • 通过django-background-tasks执行定时任务
    1.安装django-background-taskspipinstalldjango-background-tasks2.在Django项目的settings.py文件中添加以app:INSTALLED_APPS=[#otherapps'background_task',]3.创建一个包含需要执行的任务函数:frombackground_taskimportbackgroundimportrando......
  • C#基础 Math Pow Sqrt 幂与平方根
     .NETFramework:4.7.2       IDE:VisualStudioCommunity2019        OS:Windows10x64    typesetting:Markdown codeusingSystem;namespaceConsoleApp{classProgram{staticvoidMain(string[]args){......
  • codeforces round The Monster and the Squirrel 529B (数学规律)
    TheMonsterandtheSquirrelTimeLimit: 1000MS MemoryLimit: 262144KB 64bitIOFormat: %I64d&%I64uSubmit StatusDescriptionArithemonsteralwayswakesupveryearlywiththefirstrayofthesunandthefirstthingshedoesisfeedinghersqu......
  • odoo owl playground
    https://odoo.github.io/owl/playground/ /**@odoo-module**/const{Component,useState,useRef,mount,props}=owl;classTaskextendsComponent{statictemplate="tasktemplate";staticprops=["task","toggleSt......
  • Codeforces Round 850 (Div. 2, based on VK Cup 2022 - Final Round) E. Monsters (h
    传送门详细题解传送门  抄的ygg代码,向在这里说一下刚开始没看懂的部分。  求答案的时候是把所有的当前为止的所有数值加起来减去一个从1开始并且公差为1的等差数列的前size项和。其中size是当前最多能用到哪个位置,满足前size项能构成1,2,3,....,sz这样的形式。  假设我们......
  • 【MathType】word2016数学公式编号
    问题毕业论文排版中,对数学公式需要类似(3-1)的格式。解决技巧在写论文初稿的时候,先不要于公式的编号,先给它编一个号,比如(3)(2)(4)的。最后写完了以后,再再添加section,同意修改编号格式为(章-公式序号)可以先修改mathtype章节的样式为不隐藏,这样方便添加。添加完math......
  • Educational Codeforces Round 113 (Rated for Div. 2)
    题目链接B核心思路这个题目我觉得很好。首先分析下吧,如果有人需要执行操作二那么我们肯定就是给他们都打上平局是最优的。那么如果有人需要执行操作一呢,那么我们就可以把这些需要执行操作1的都搞一起。然后是他们成一个环。这样肯定就保证了每个人都会赢上一次。C核心思路......
  • Codeforces Round 866 (Div. 2)
    A.Yura'sNewName一个简单的dp,状态是\(f[i][0/1]\)表示前\(i\)位变成合法的且最后一位是^或_的最小代价。如果是_只能从^转移过来,如果是^则都可以转移过来#include<bits/stdc++.h>usingnamespacestd;voidsolve(){ strings; cin>>s; intn=s.size(); if(n=......