60分求助

B2016 浮点数向零舍入

```cpp #include<bits/stdc++.h> using namespace std; int main(){ double x; cin>>x; if(x<0){ x=ceil(x); } if(x>0){ x=floor(x); } cout<<(long long)x; return 0; } ```
by jyc123456 @ 2022-07-25 15:30:48


1. float 精度是不够的 2. 不看long long 见祖宗
by jyc123456 @ 2022-07-25 15:32:06


@[shensteve](/user/737406)
by jyc123456 @ 2022-07-25 15:32:34


@[jyc123456](/user/374371) 谢谢
by shensteve @ 2022-07-25 15:35:35


|