|
|
I've got AC using long number arithmetics. Somebody solve this problem without the use of long arithmetic? 21 9e0 9e1 9e2 9e3 9e4 9e5 9e6 9e7 9e8 9e9 9e10 9e11 9e12 9e13 9e14 9e15 9e16 9e17 9e18 9e19 9e20 Correct answer is 1.000000000000000000e21 My AC program outputs 9.9999999999999999999e20 This answer is also correct. Your program have not to round answer. From my experience, I think it is necessary to round the answer. Yes, you are right. The ans must get rounding Must I use long arithmetic to solve this problem? If no, than what standart type i must to use? Here it is some numbers in exponentional notation. Maybe they will help anybody: 1e1 1e0 1.0e1 1.12312e-100 Yes, It may be WA because the dot('.') isn't there #include <stdio.h> #include <string.h> int main() { long double a, b; int n, i, j; b = 0.0; scanf("%ld", &n); for (i = 0; i < n; ++i) { scanf("%Lf", &a); b += a; } printf("%.18Le", b); return 0; } Sorry for my bad English :( Edited by author 28.09.2004 01:50 What is exponential notation in this problem? I think that it is A.BeK, where 1<=A<=9. Am I right? What parts can be absent? 1)For example, are the numbers 1.0 1.e10 .1 5 9e1 possible in this problem? 2) Which output is correct? 7.000000000000000000 OR 7.000000000000000000e0 3) Which output is correct? 1.5e3 OR 1.500000000000000000e3 > I think trunc...however the problem is locked...I can't check it! > MAYBE WRONG FORMAR. MAYBE {$N+}. ROUND!!!! 1.9..99 -> 2.0...00 1.9..95 -> 2.0...00 1.9..91 -> 1.9...90 ( ^^^ last digit is 20-th you don't need to output it) Edited by author 09.04.2004 01:09 Are you sure that all of "next N lines contain the elements in exponential notation with 19 significant digits in mantissa" ? Especially "one number on each string" ("по одному в строке"), as it is written in russian version of problem. (Test #6). "exponential notation" means more than I expected. Is it locked now?? Who can tell me! Is it locked now?? Who can tell me! Why Problem Temporary Locked? What is it? |
|
|