使用long double
#include <iostream>
#include <cstdio>
using namespace std;
long double ans=0.0, xx;
int main(){
while(scanf("%Lf", &xx)!=EOF)
ans = ans + xx * 1000000;
printf("%.5Lf", ans/1000000);
return 0;
}
使用long double
#include <iostream>
#include <cstdio>
using namespace std;
long double ans=0.0, xx;
int main(){
while(scanf("%Lf", &xx)!=EOF)
ans = ans + xx * 1000000;
printf("%.5Lf", ans/1000000);
return 0;
}