题解 | #取近似值#
取近似值
https://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
#include <iostream> using namespace std; int main() { float a; cin>>a; cout << (int)(a + 0.5) << endl;//取整 } // 64 位输出请用 printf("%lld")
取近似值
https://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
#include <iostream> using namespace std; int main() { float a; cin>>a; cout << (int)(a + 0.5) << endl;//取整 } // 64 位输出请用 printf("%lld")
相关推荐