题解 | #取近似值#
取近似值
https://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
#include <iostream>
using namespace std;
int main(){
double num;
cin>> num;
int i=num;
if (num-i <0.5 )
cout<<i;
else
cout<<i+1;
return 0;
}
using namespace std;
int main(){
double num;
cin>> num;
int i=num;
if (num-i <0.5 )
cout<<i;
else
cout<<i+1;
return 0;
}