题解 | #取近似值#
取近似值
https://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
#include <iostream>
using namespace std;
int main() {
float f;
int res;
cin >> f;
if (f + 0.5 >= (int)f + 1) {
res = f + 1;
}
else {
res = f;
}
cout << res << endl;
return 0;
}
查看12道真题和解析