| 
 | 
back to boardAccepted on C++ #include <stdio.h> #include <math.h> double stack[131073]; int main() {     int index = -1;     while(scanf("%lf", &stack[++index]) != EOF);     for(; index > 0;printf("%.4lf\n", sqrt(stack[--index])));     return 0; } Re: Accepted on C++ If the digit is negative? Re: Accepted on C++ Posted by  Ouch 29 Oct 2013 19:48 If the digit is negative? Just use the same method, and append "i" to denote the imaginary number. Re: Accepted on C++ Hi, can this code be accepted? The input value can be much larger than double value, even long type. Re: Accepted on C++ A strange fact:   [...] double  b[100000000]; int i = 0;   int main(){     while (scanf("%lf", &b[i++]) == 1); i--;     while (i > 0)         printf("%.4lf\n", sqrt((double)b[--i]));     return 0; }   Get AC BUT:   [...] long long  b[100000000]; int i = 0;   int main(){     long long a;     while (scanf("%lld", &b[i++]) == 1); i--;     while (i > 0)         printf("%.4lf\n", sqrt((double)b[--i]));     return 0; }   Gets WA 1. I understand nothing in this life..=) I wonder where may be mistake?   Compiler G++ 4.7.2 Re: Accepted on C++ Posted by  Sauron 21 Nov 2013 00:34 If the digit is negative? lol 0<=A<=10^18 read description :P  Edited by author 21.11.2013 00:35 Edited by author 21.11.2013 00:35Re: Accepted on C++ Posted by  cures 18 May 2014 09:51 Mingw gcc does not recognize %lld, use %I64u. And now it does not work with %.4lf in printf, only with %.4f (in C++11 mode). Re: Accepted on C++ Posted by  Ping_23 24 May 2014 22:00 Well, it should be double not long long since the output is in real number A strange fact:   [...] double  b[100000000]; int i = 0;   int main(){     while (scanf("%lf", &b[i++]) == 1); i--;     while (i > 0)         printf("%.4lf\n", sqrt((double)b[--i]));     return 0; }   Get AC BUT:   [...] long long  b[100000000]; int i = 0;   int main(){     long long a;     while (scanf("%lld", &b[i++]) == 1); i--;     while (i > 0)         printf("%.4lf\n", sqrt((double)b[--i]));     return 0; }   Gets WA 1. I understand nothing in this life..=) I wonder where may be mistake?   Compiler G++ 4.7.2  |  
  | 
|