Du pit father God

Original title:

As we all know, very much like a big God Du simulation, also I liked to set some details deceptive. For example, in a contest, he's so out of a problem

(Hereinafter omitted 3000 words)

After calculating the answer a, you should be a by 1000, to retain the output to two decimal places, rounded.

To ensure a non-negative integer, and represents the range of not more than 64-bit signed integer.

Entry

A plurality of sets of data, each data line 1, comprising the integer a.

Export

Each data output line, God will answer you represent Du output.

 

This dish question, I'm not a one size fits all

1 while(scanf("%lld",&a)!=EOF){
2      printf("%.2Lf\n",(long double)a/1000.0);

Big Brother listening to the group that in order to prevent the throw precision, rounding the best plus eps

1 while(scanf("%lld",&a)!=EOF){
2         printf("%.2Lf\n",(long double)a/1000.0+eps);

longdouble lack of precision

Then I split in half

1 while(scanf("%lld",&a)!=EOF){
2         long long b=a/10000;  a=a%10000;
3         if(b)  printf("%lld",b);
4         printf("%.2Lf\n",(long double)a/1000.0+eps);

99999, carry occurs go wrong

That I might judge the last number always okay

1 while(scanf("%lld",&a)!=EOF){
2         long long b=a/10+(a%10>=5);
3         printf("%.2Lf\n",(long double)b/100.0);

 

Guess you like

Origin www.cnblogs.com/cdcq/p/11619595.html