| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| WA12......Can anybody give some f**k data. | grayluck | 1074. Очень короткая задача | 23 мар 2010 05:22 | 3 |
I've check all the data here..but i still get WA#12.. #include <iostream> #include <cstring> #include <string> #define inf 214748364 using namespace std; struct tmono { int n[9000]; int w,nega,xs; }; char s[1000]; int xs,len,con,e; tmono num; string res; inline bool isnum(char ch) { return '0'<=ch&&ch<='9'; } inline bool getnum(int st,int en,tmono &e) { memset(e.n,0,sizeof(e.n)); e.w=0;e.xs=0;e.nega=0; if(s[st]=='-') e.nega=1,++st; else if(s[st]=='+') e.nega=0,++st; /* while(s[st]=='+'||s[st]=='-') { if(s[st]=='-') e.nega=!e.nega; ++st; } */ for(int i=en;i>=st;i--) if(s[i]=='.') { e.xs=en-i; for(int j=i;j<en;j++) s[j]=s[j+1]; --en; break; } for(int i=st;i<=en;i++) if(!isnum(s[i])) return 0; e.w=0; for(int i=en;i>=st;i--) e.n[++e.w]=s[i]-'0'; return 1; } inline bool work() { res=""; cin>>xs; int tempxs=xs; scanf("\n"); if(s[0]=='.') { for(int i=len-1;i>=0;i--) s[i+1]=s[i]; s[0]='0'; len++; } if(!isnum(s[0])&&s[0]!='-'&&s[0]!='+') return 0; con=0; for(int i=0;i<len;i++) { if(s[i]=='e'||s[i]=='E') { if(con!=0) return 0; con=i; } if(s[i]!='e'&&s[i]!='E'&&s[i]!='-'&&s[i]!='+' &&s[i]!='.'&&!isnum(s[i])) return 0; if(s[i]=='.'&&!isnum(s[i+1])) return 0; } e=0; bool enega=0; if(con!=0) { e=-inf; int j=con; con++; if(s[con]=='+'||s[con]=='-') { if(s[con]=='-') enega=!enega; con++; } /* while(s[con]=='-'||s[con]=='+') { if(s[con]=='-') enega=!enega; ++con; }*/ for(int i=con;i<len;i++) { if(!isnum(s[i])) return 0; if(e==-inf) e=0; e=e*10+s[i]-'0'; if(e>500) break; } if(e==-inf) return 0; if(enega) e*=-1; len=j; } --len; if(!getnum(0,len,num)) return 0; num.xs-=e; while(num.n[num.w]==0&&num.w>0) --num.w; bool isxs=0; if(num.xs<=0) { for(int i=num.w;i>=1;i--) res+=num.n[i]+'0'; while(num.xs<0) { res+="0"; num.xs++; } }else { int j=max(num.w,num.xs); if(num.xs>num.w) { num.w=num.xs; num.xs=0; res+="0."; isxs=1; } for(int i=j;i>=1;i--) { if(i==num.xs) isxs=1; if(isxs&&xs==0) break; if(i==num.xs) res+="."; if(isxs)--xs; res+=num.n[i]+'0'; } } while(xs>0) { if(!isxs) res+=".",isxs=1; res+="0",--xs; } while(res[0]=='0') res.erase(0,1); if(res.length()==0) res.insert(0,"0"); if(res[0]=='.') res.insert(0,"0"); for(int i=0;i<res.length();i++) if(res[i]=='.') if(res.length()-i<tempxs) { tempxs-=res.length()-i; while(tempxs--) res.insert(res.length()-1,"0"); }else res.erase(i+tempxs,res.length()-i-tempxs-1); if(res[res.length()-1]=='.') res.erase(res.length()-1,1);
if(num.nega) for(int i=0;i<res.length();i++) if('1'<=res[i]&&res[i]<='9') { res.insert(0,"-"); break; } for(int i=1;i<res.length();i++) if(res[i]=='.'&&!isnum(res[i-1])) { res.insert(i,"0"); break; } if(res[res.length()-1]=='.') res.erase(res.length()-1,1);
res+="\n"; return 1; } inline void reads() { memset(s,0,sizeof(s)); gets(s); len=strlen(s); while(len>=1&&isspace(s[len-1])) s[len]=0,--len; while(isspace(s[0])) { for(int j=0;j<len-1;j++) s[j]=s[j+1]; s[len]=0;len--; } } int main() { #ifndef ONLINE_JUDGE freopen("input.in","r",stdin); freopen("output.out","w",stdout); #endif reads(); while(!(strlen(s)==1&&s[0]=='#')) { if(!work()) printf("Not a floating point number\n"); else cout<<res; reads(); } return 0; } Check that: S12.0 2 # where S is a space (" "). My AC program says that its not a correct number because of leading space. "For each pair of lines your program should write to an output a message: "Not a floating point number", if the string S is not a correct <real number>..." <real number> does not contain spaces. =) Good luck! Many thanks!!!really a helpful suggest! now I got AC. thanks again! Edited by author 23.03.2010 05:23 |
| FOR PEOPLE (TEST) (+) | Виктор Крупко | 1074. Очень короткая задача | 22 мар 2010 12:34 | 2 |
NOT FLOATING FOR 1)1E2.1 2)2E2+1 3)2E2-1 4)E 5)-+3 6)3EE ----------------------------------------- 1) 1E1 1 10.0 1E+1 1 10.0 0E10 1 0.0 0 1 0.0 000.1 1 0.1 0.1E1 0 1 why"-+3" isn't a correct number.? |
| Is my algo correct? | Lebedev_Nicolay[Ivanovo SPU] | 1176. Гиперканалы | 22 мар 2010 11:12 | 2 |
Is my greedy algo correct? On each step I choose an edge to vertex with the greatest out-degree. I have WA 8. No (-) Erop [USU] 22 мар 2010 11:12 Of course, you should find Euler cycle |
| Weak tests | Fyodor Menshikov | 1246. Собака на привязи | 22 мар 2010 08:37 | 3 |
I know AC solution that counts number of cw and ccw moves from point i to i+1 seen from the first point. Here is the test on which this AC solution answers cw but correct answer is ccw. 17 0 0 10 0 10 10 11 10 11 9 11 8 11 7 11 6 11 5 11 4 11 3 11 2 11 1 11 0 12 0 12 11 0 11 I'm agree with you. Edited by author 22.03.2010 08:38 I'm sorry. I find my mistake/ |
| Explain me the condition of the problem, please | [SPbSU ITMO] Dennis Yolkin | 1282. Game Tree | 22 мар 2010 02:21 | 2 |
I don't understand this problem. As I think, the third sample is the tree from the picture. But I can not understand why, for example, 'the number of the ancestor of this node' for the node #18 is 12? What does it mean, 'the number of the ancestor of this node'? THank you. As you can see in a picture, the node #18 connected with the #12 node, and - #18 is a child for #12; - #12 is a ancestor, farther (mother) of #18. In phrase "the number of the ancestor of this node" the word "number" should be understood ad index (the index of the node, which is an ancestor for target node). |
| Suggest some other testcases | kylin | 1760. Адская работа | 21 мар 2010 23:40 | 1 |
small a, big b, big n, and the LCM of a and b is larger than n. such as 3 24999998 25000000 Edited by author 21.03.2010 23:41 |
| need help. | ACM.Anatoliy 'Tolyan_NO' Tolstobroff | 1325. Грязь | 21 мар 2010 21:44 | 4 |
need help. ACM.Anatoliy 'Tolyan_NO' Tolstobroff 21 окт 2005 16:10 I have written 2 programs and both get WA19 It is very strange, I am already tired to write programs to this problem. first 2*BFS secondar Dijkvasta+Heap both got Wa19 i not understand why. Somebody help me? hi I don't understand in english. hwo can explain this question in Azeri or Turkish or in english but with sample sentenceses you just need to do 2 BFS Edited by author 22.03.2010 02:04 Edited by author 22.03.2010 02:04 |
| why WA in 6 | zzzlll | 1013. K-ичные числа. Версия 3 | 21 мар 2010 18:34 | 2 |
there is my program var c:array[0..1800] of real; n,m,i ,fn:longint; begin readln(n,m); c[0]:=1; c[1]:=m-1; i:=1; repeat i:=i+1; {for i:=2 to n do } c[i]:=(m-1)*(c[i-1]+c[i-2]); until i>=n; writeln(c[n]:0:0); end. Because There is some testcases that have more than 1800 decimal digits.You should write Big int for this problem. |
| To judjes: very funny! | bsu.mmf.team | 1541. Погоня | 21 мар 2010 12:34 | 2 |
My AC program runs about 10 seconds on following tests; 4 41 4 49 (on this test it works more, that 1 minute!!!) 17 43 19 49 41 43 50 41 50 43 I can write about 10 more tests, but, I think, it's enough:) Could you add some of these tests? Your tests were added, and problem was rejudged. Thank you. |
| I've got AC, but in 1.968 second, please help me!!!! | Cyclops | 1023. Пуговицы | 21 мар 2010 06:24 | 3 |
Here is my code, what can make my code run faster? Please check it up... #include <iostream> #include <cmath> using namespace std; bool prime(long long x) { int i;
if(x==2) return true; else if(x%2==0) return false;
for(i=3; i*i<=x; i+=2) if(x%i==0) return false; return true;
} int main() { long long K, s;
cin>>K; if(prime(K)==true) { cout<<K-1; return 0; } else { for(long long i=3; i<499999950; i++) { if(K%i==0) { cout<<i-1; return 0; } } } return 0; } Функция Prime может быть встроена в main Вместо if(Prime(K)==true) можно писать if(Prime(K)) oh my... =) This lazy code gets AC in 0.562s #include <cstdio> int n,r; int main() { .scanf("%d", &n); .r=2; .while ( n % (r+1) != 0 ) ..++r; .printf("%d",r); .return 0; } And this a little bit (only a little) improved, especially for you, gets AC in 0.296s. #include <cstdio> int n,r; int main() { .scanf("%d", &n); .if ( n % 3 == 0 ) .printf("2"); .else if ( n % 4 == 0 ) ..printf("3"); .else .{ ..r=4; ..while ( n % ++r != 0 ) ...++r; ..printf("%d",r-1); .} .return 0; } |
| For those who have WA#3 | † Ленин † [Yaroslavl SU] | 1211. Круговая порука | 21 мар 2010 05:32 | 1 |
Hope this test can help you: 2 3 2 1 0 1 0 - NO YES Good luck! |
| why my program doesnot work on test#2???? | tvm | 1049. Отважные воздухоплаватели | 21 мар 2010 05:16 | 1 |
why my program doesnot work on WA#2???? var a:array [1..10000] of integer; i,k,s:integer; begin k:=0; s:=1; for i:=1 to 10 do readln(a[i]); for i:=1 to 10 do s:=s*a[i]; for i:=1 to s do if s mod i=0 then k:=k+1; if (k>0)and (k<10) then writeln(k); end. Edited by author 21.03.2010 05:16 |
| I have WA7. HELP!!! | Amirbekov Artem[Ivanovo SPU] | 1715. Another Ball Killer | 21 мар 2010 04:45 | 1 |
I can't find a mistake in my solution. Can anybody give me any hint? |
| NP? | Vit Demidenko | 1758. К вопросу о лысине 2 | 21 мар 2010 03:57 | 3 |
NP? Vit Demidenko 19 мар 2010 22:07 Re: NP? Erop [USU] 19 мар 2010 22:56 Re: NP? Roman Atangulov (Moscow SU) 21 мар 2010 03:57 |
| (C++)Got WA on test14, can you help me? | Boqian Jiang | 1011. Кондукторы | 21 мар 2010 00:07 | 2 |
#include <cstdlib> #include <iostream> #include <iomanip> using namespace std; int main(int argc, char *argv[]) {
double a,b,c,d,m,n=2,mn; cin>>a>>b; c=a/100; d=b/100; while (1) {m=1; while (m<n) {mn=m/n; if ((mn<d)&&(mn>c)) break; m++;} if (m!=n) break; n++;} cout<<n<<endl; system("PAUSE"); return EXIT_SUCCESS; } This is my project Got WA on test14. I think there's something wrong with digits But i cannot find it Can anyone help me with it? Thx! I think, your mistake in precision. Try change: if ((mn<d)&&(mn>c)) -> if ((mn+eps<d)&&(mn-eps>c)) |
| how quick? | lian lian | 1203. Научная конференция | 20 мар 2010 16:42 | 2 |
I used "dp" and spend 261k space and 0.046 time, but i see the rank 1 only used 0.015 second?
How did he make it? |
| WA #8 | Marginean Ciprian | 1753. Книжная полка | 20 мар 2010 16:14 | 1 |
WA #8 Marginean Ciprian 20 мар 2010 16:14 Does it mean that we need to calculate the maximal displacement where the center goes even when it falls? And after the book starts falling must we consider that the book just rotates around the edge of the bookshelf? or it slides a little backwards. Some more explanation of the problem text and maybe some hints would be welcomed. Thank you. L.E. Now I get WA 8. I don't think there is a problem with precision, or something like that. Some more samples to pass this test? Does L have to be used at anything? I believe not since L>H. L.L.E. My WA 8 was from a division by 2 of an integer variable, which I assigned to a double variable. The problem was solved when I divided by 2.0 Edited by author 25.03.2010 20:20 |
| curiously, g++, version 4.3.2 build it. But your Intel didn't. | [neUSU]And_IV | 1640. Кольцо холода | 20 мар 2010 03:12 | 2 |
#include<iostream> #include<algorithm> #include <list> #include <math.h> #include <iomanip> using namespace std; /*CODE*/ int main() { /*CODE*/ cout<<setprecision(9)<<fixed<</*CODE*/ <<sqrt(r2); return 0; } Using proprietary Intel compiler instead of free and de facto standard GCC is outrageous! I guess ФАС should investigate how this happened :-) |
| Test 10 | marks | 1490. Огненный круг | 20 мар 2010 02:34 | 2 |
What's wrong with the test 10? #include<stdio.h> int main(){ long unsigned int x,y=0,z=0,q,p,r; scanf("%lu",&r); x=r; q=r*r; do{ p=q-y*y; while( x*x >= p && x >= 0 )x--; z+=(x+1); y++; }while(y<r); z*=4; printf("%lu\n",z); return 0; } Используй long long и/или long double |
| 1 TEST | →MOPDOBOPOT← | 1711. Кодовые имена | 20 мар 2010 00:07 | 1 |
1 TEST →MOPDOBOPOT← 20 мар 2010 00:07 |