Show all threads Hide all threads Show all messages Hide all messages |
How to interpret "at least four digits"? | candide | 1001. Reverse Root | 5 May 2013 18:33 | 1 |
I don't know what is meant with the wording "at least four digits after decimal point". Does it mean the first four digits have to be exact ? I got WA with the format "%.4f" (at leat in Python) and i got AC with a code using the "%.5f" format. But the later doesn't guarantee you get the first four digits correct. For instance if x=10000085 then y=sqrt(x)=3162.291099819876... and "%.5f" %y prints 3162.29110 giving only 3 right digits after decimal point. And the examples given in the sample don't help. |
Change reading if you got WA9 | crdp | 1438. Time Limit Exceeded | 5 May 2013 12:02 | 1 |
I've changed input reading method from "read line by line" to "read word by word", and got AC because of it. Which seems strange. Probably, test 9 is incorrect. |
WA1 | whatthefua | 1307. Archiver | 5 May 2013 09:27 | 1 |
WA1 whatthefua 5 May 2013 09:27 I suppose my error is either in the procedure of scanning/printing. My program receives input and prints output using file pointers. FILE *fi,*fo; fi = stdin; fo = stdout; And the program reads/writes by fscanf/fprintf. If you have any knowledge concerning the input/output for this problem, please comment. |
Wrong answer Test 14 | BUTKO_VNU | 1820. Ural Steaks | 5 May 2013 04:09 | 2 |
#include <iostream> using namespace std; int main() { int a,b,i=0,x=0,y=0; cin>>a>>b;
while(x+b<=a) { x=x+b; i++; } y=a-x; if(y>0) { i++; } while((y+b)<a) { y=y+b; i++; } i++;
cout<<i;
return 0; } |
Is there geometric (not numerical) solution? | Vedernikoff 'Goryinyich' Sergey (HSE: АОП) | 1938. Caribbean Triangle | 5 May 2013 02:04 | 3 |
Solved numerically, but with complete botva. Is there some beautiful geometric solution? If yes - any clues how to do it? Thanks. There is really beautiful geometric solution. Try to think about rotation. My solution is geometric with little cheat (3 cases, 2 solves geometrically, in third (3 lines have one point of intersection) - answer is any triandle with length of edge 1.1*1e-6 and center in the point of intersection), but WA21 :( Edited by author 05.05.2013 02:07 Edited by author 05.05.2013 02:07 Edited by author 05.05.2013 02:07 |
Why my code does not work? Any sample input to think? | Hissain | 1877. Bicycle Codes | 5 May 2013 00:53 | 3 |
#include<stdio.h> int main(){ int m,n; while(scanf("%d %d",&m,&n) == 2){ if(m == 0 || n == 1){ printf("yes\n"); }else{ printf("no\n"); } } return 0; } Why do you use "while" for reading? |
WA 21 - someone know, WTF? | Cat36 | 1938. Caribbean Triangle | 4 May 2013 20:27 | 1 |
|
Dymanic Programing. | Y.Y.M. | 1117. Hierarchy | 4 May 2013 19:11 | 7 |
Time Limit Exceeded Test#12 what do? I think we only remember 1 to 2^i this mean G(1,i) then F(1,N]=F(1,2^i)+i-1+F(2^i+1,N) ==> F(1,N)=G(1,i)+i-1+F(2^i+1,N) while the last F(2^i+1,N)=F(1,N-2^i-1) and so on certainly f(1,1)=0; Edited by author 04.05.2013 19:28 I just use something like low_bit and calc the answer easily in logN time. You may use Abs(Dis(1,A) - Dis(1,B)) it is a good way to solve this problem. Sorry for my poor English. Edited by author 14.11.2005 21:19 15 strings - And AC - Cool!!! - time 0.015 |
No subject | Irene | 1000. A+B Problem | 4 May 2013 01:13 | 1 |
|
Runtime Error on C# | Pelevina | 1487. Chinese Football | 3 May 2013 20:34 | 1 |
почему возникает такая проблема? код вроде соответствует примеру, приведенному в руководстве. В Visual Studio 2010 все работает. что делать? |
Runtime Error on C# | Pelevina | | 3 May 2013 20:20 | 1 |
почему возникает такая проблема? код вроде соответствует примеру, приведенному в руководстве. В Visual Studio 2010 все работает. что делать? |
Stuck at test 3 | maple | 1020. Rope | 3 May 2013 18:12 | 1 |
Unable to clear test3. please help #include<stdio.h> #include<math.h> int main() { float r; float sum=0.0; int i,n,nxt=0; scanf("%d %f",&n,&r);
float dim[n][2]; for(i=0; i<n;i++) { scanf("%f%f",&dim[i][0],&dim[i][1]); }
for(i=0;i<n;i++) { if(i+1==n) nxt=n; else nxt=i+1; float y=pow((dim[i][0]-dim[nxt][0]),2); float z=pow((dim[i][1]-dim[nxt][1]),2); y=y+z; sum+=sqrt(y);
} sum+=2*3.14159*r;
printf("%.02f\n",sum); return 0; } |
algorithm | ilucian1 | 1389. Roadworks | 3 May 2013 18:00 | 3 |
First of all I suppose the graph is a tree (M=N-1 and all vertices are connected, see the text). Is it a tree? I choose one vertex (let it be 1) and consider it as root. I perform breadth first algorithm starting from the root and obtain vertices in increasing order of distances (in the same time I obtain the parent for each vertex). The result is the array C[1..N]. From N downto 1 I search for available C[i] and P[C[i]] (P[C[i]] is the parent for C[i]). I mark C[i] and P[C[i]] not to be used furthermore (unavailable). The edge [C[i],P[C[i]] is part of solution and the final result is WA on test 7... what's wrong ? Edited by author 15.11.2005 20:32 The algorithm was correct but I ignored the output format ... AC now Hi, I have the same problem with WA #7, in what way was the output format wrong? |
Wrong Answer (Test 3) | axtrace | 1001. Reverse Root | 3 May 2013 17:34 | 1 |
I don't know why Please help if you can #include <stdio.h> #include <stdlib.h> #include <math.h> #include <malloc.h> int main() { char* Buffer =(char*) calloc(1, sizeof(*Buffer)); int i=0,j, ch,k; double value =0.0f; int wasValueReadingStarted=0, NeedToBePrinted=1; ch = getchar(); while (ch != EOF) { if(i) { Buffer = (char*)realloc(Buffer, (i+1)*sizeof(*Buffer)); } Buffer[i]=ch; ch = getchar(); i++; }
j = i-1;
while (j>=0) { ch = Buffer[j]; if (ch ==' ' || ch == '\t' || ch == '\n') { k=0; if (wasValueReadingStarted && NeedToBePrinted) { printf("%.4f\n", sqrt(value)); NeedToBePrinted=0; value = 0.0f; } } else { value += (ch-'0')*pow(10,k); wasValueReadingStarted = 1; NeedToBePrinted=1; k++; } j--; } if (wasValueReadingStarted && NeedToBePrinted) printf("%.4f\n", sqrt(value)); return 0; } Edited by author 03.05.2013 17:36 |
tell me please whats wrong? | alexstyle | 1493. One Step from Happiness | 3 May 2013 15:52 | 2 |
main() { long n,sumperv=0,sumposled=0,perv,posled; int flag=0; scanf ("%ld",&n); perv=(n+1)/1000; posled=(n+1)%1000; while (perv) { sumperv+=perv%10; perv/=10; } while (posled) { sumposled+=posled%10; posled/=10; } if (sumperv==sumposled) flag=1; perv=(n-1)/1000; posled=(n-1)%1000; sumperv=0; sumposled=0; while (perv) { sumperv+=perv%10; perv/=10; } while (posled) { sumposled+=posled%10; posled/=10; } if (sumperv==sumposled) flag=1;
if (flag==1) printf ("yes"); else printf ("no");
} |
WA 10 | Sunnat | 1684. Jack's Last Word | 3 May 2013 15:20 | 1 |
WA 10 Sunnat 3 May 2013 15:20 [code delete] Edited by author 09.05.2013 15:31 |
WA12, anyone know? | ErikJ | 1080. Map Coloring | 3 May 2013 01:16 | 1 |
Hi, Does anyone have test 12 and it's output so that I can debug my program? |
No subject | second | 1209. 1, 10, 100, 1000... | 2 May 2013 21:32 | 1 |
Edited by author 03.05.2013 12:20 |
TLE | B&B | 1001. Reverse Root | 1 May 2013 20:05 | 2 |
Why TLE on 1 test? It takes no time on example. Any piece of advice? #include <cstdio> #include <vector> #include <cmath> using namespace std; int main() { vector<long long> n; long long a = 0; while( a != EOF) { scanf("%llu", &a); n.push_back(a); } for (int i = n.size() - 2; i >= 0; i--) { printf("%.4f\n", sqrt(long double(n.at(i)))); } return 0; } Looks like I've caught it. It freezes if ctrl+d used for EOF and it's do not response if ctrl+z used, when -1 used everything is OK. Edited by author 01.05.2013 20:12 Edited by author 01.05.2013 20:12 |
Why 22121112 why not 22121121? | mehran | 1501. Sense of Beauty | 1 May 2013 19:23 | 2 |
I think both answer would do |