题解 | 复读机
复读机
https://www.nowcoder.com/practice/9d381551b6ab40c4b5c3c8d60fe4066e
#include <cstddef>
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main() {
string a;
while(cin >> a){
size_t pos = a.find(".");
if(pos != string::npos && a.length() > pos +1){
double num = stod(a);
printf("%0.1f\n",num);
}else
cout << a << endl;
}
}
// 64 位输出请用 printf("%lld")

查看12道真题和解析