Show all threads Hide all threads Show all messages Hide all messages |
Page 8 |
If you get WA10 | Ulugbek#& | 1027. D++ Again | 5 Oct 2021 14:34 | 2 |
I've got several times WA 10 and in the forum I couldn't find any test for this test, and finally I found where was the mistake. Try this: (* WTF?!! * ) answer is yes No! It's wrong. The asnwer is NO because the comment isn't closed. The comment should end by '*)', not '*\n)' |
2 Admins: I probably found bad test for my AC solution | Khranovsky`~ | 1027. D++ Again | 14 Aug 2018 17:11 | 2 |
Test: ((**)*) My answer is YES, but if we delete comment (**) it will remain only (*) and it must be arithmetic expr, but it's not cuz arithmetic expressions can't start with (*, so the right answer is NO, am I wrong? You are wrong. There are no rules for comments if there are no comments. lol |
Why read text with std::getc got AC 0.001s and fread got AC 0.015s for C++ compilers ???? | c_pp | 1027. D++ Again | 15 Dec 2016 00:14 | 1 |
char s[16384] ; unsigned n = 0; // AC 0.001s with this code. for(int c = std::getc(stdin); c != EOF; c = std::getc(stdin)) s[n++] = c; // and AC 0.015s with n = fread(s,1,sizeof(s)-1,stdin); code. // I'm wonder that the std::getc faster than fread!! |
WA 2 with C++ | Fritee | 1027. D++ Again | 30 Jan 2015 01:17 | 1 |
[deleted] P.S. Don't EVER forget to initialize your variables. Edited by author 30.01.2015 01:18 Edited by author 30.01.2015 01:19 |
Page 7 |
What's the test 4?? | zylm | 1027. D++ Again | 14 Aug 2018 17:20 | 2 |
I use "string ch" AC,but " char ch[maxn]" WA4,I don't know why ..... You may be forgetting that C strings contain ONE more character that is called terminal character (or whatever). So it must be 10001. And it works! for me |
Helpful TEST CASES | Dmitry | 1027. D++ Again | 2 Dec 2017 02:48 | 2 |
Note*: if you have WA1 just skip all #10 and #13 symbols from input data! ((*Answer is YES*)) (((*Answer is YES*))) (**) YES (* NO (*) NO (*(*) YES (11(*)) NO (*(**)*) NO ((**)*)(**)*) NO! ((**)*) YES ()() (()) ((())) YES (1+1 ) YES THANK YOU very much for "(*(*) YES"! |
WA Test #24 | Fasterm | 1027. D++ Again | 30 Dec 2012 19:50 | 1 |
Can anybody tell what the problem ? Edited by author 30.12.2012 19:51 |
WA26 | liuzy | 1027. D++ Again | 27 Sep 2012 13:54 | 1 |
WA26 liuzy 27 Sep 2012 13:54 I think my program is correct. Who can tell me why I got wa? #include<cstdio> #include<cstdlib> #include<cstring> char a[100005],b[100000]; char cs[]="=+-*/0123456789)("; bool pd(char ch){ for(int i=0;i<17;i++) if(ch==cs[i]) return 1; return 0; } int main(){ while(gets(b)){ strcat(a,b); } int len=strlen(a); int ha=0,k=0; for(int i=0;i<len;i++){ if(ha){ if(a[i]=='*' && a[i+1]==')') ha=0; }else{ if(a[i]=='*' && a[i-1]=='(') ha=1; else{ if(k>0 && (!pd(a[i]))){ printf("NO"); return 0; } if(a[i]=='(') k++; if(a[i]==')') k--; if(k<0) { printf("NO"); return 0;} } } } if(ha || k!=0) { printf("NO"); return 0; } else printf("YES"); system("pause"); return 0; } |
WA1 HINT | MOPDOBOPOT (USU) | 1027. D++ Again | 1 Aug 2012 17:34 | 1 |
WA1 HINT MOPDOBOPOT (USU) 1 Aug 2012 17:34 If you have WA1 just skip all #10 and #13 symbols from input data! |
WA2 solution | casey | 1027. D++ Again | 13 Jul 2012 12:00 | 1 |
You may not still be in a comment when you finish reading all input. |
Help with Test data #8 | __Emiapwil__ | 1027. D++ Again | 7 Apr 2012 14:04 | 2 |
Hey, everybody! I'd like to ask for a test data of this problem similar to test #8. I've read through the discussions and passed all the test data given in earlier topics but still got stuck at #8. Any help will be appreciated!! Edited by author 07.04.2012 14:05 I've figured out the problem! It seems that I'm not familiar with the 'feof' function's action. In fact earlier discussions mentioned it but since the vim editor appends a newline in the end of my test input file I was unable to notice this. May this be of any help for those who meet the same problem. |
Reg test suite for problem 1027. D++ Again | hariprasad.puvvadi | 1027. D++ Again | 17 Jan 2012 16:39 | 1 |
Is there any link where I can access\download the input test vectors for problem "1027. D++ Again" ? -Hari |
hint | Anton | 1027. D++ Again | 18 Dec 2011 19:03 | 1 |
hint Anton 18 Dec 2011 19:03 use state machine with char-by-char reading. We know last char and last state, so we can find next state. Brackets should be counting during reading. If we have '(', so we plus 1, ')' - minus 1. If brackets < 0 and state is some of arifmetic state - it's error. |
If you have WA #31 | Smilodon_am [Obninsk INPE] | 1027. D++ Again | 26 Sep 2016 18:01 | 2 |
|
Problem 1027 "D++ Again" has been rejudged. (+) | Sandro (USU) | 1027. D++ Again | 7 Nov 2011 00:39 | 1 |
New tricky test was added, and all AC submissions were rejudged. 96 authors lost AC. |
test#26 | MoonRandom | 1027. D++ Again | 26 Oct 2011 15:40 | 1 |
test#26 MoonRandom 26 Oct 2011 15:40 why test#26 ... what mean? |
Correct input | ValenKof | 1027. D++ Again | 7 Aug 2011 19:19 | 1 |
I use this and get AC: char str[30010]; int strsize = 0; while (fgets(str + strsize, 20000, stdin)) strsize = strlen(str) - 1; ++strsize; |
WA1? read me | Lavrentiy Palovich | 1027. D++ Again | 4 Jul 2011 19:31 | 1 |
do not save newlines! make if to skip them for example: cin >> noskipws; while(cin >> ch) { if (ch != '\n') s[n++] = ch } |
WA26 | Gelioscope | 1027. D++ Again | 25 Jun 2011 17:23 | 3 |
WA26 Gelioscope 25 Jun 2011 11:42 This is my code: #include <stdio.h> #include <string.h> #define ulong unsigned long void main() { #ifndef ONLINE_JUDGE freopen("in.txt","rt",stdin); freopen("out.txt","wt",stdout); #endif bool comment=0,arithmetical=0; long brakets=0; char syms[10001]; ulong i=0; while(fgets(syms+i,10000,stdin)) { i=strlen(syms)-1; } for(i=0;i<strlen(syms);++i) { if(comment) { for(;i<strlen(syms);++i) if(syms[i]=='*'&&syms[i+1]==')') { ++i; comment=0; break; } continue; } if(arithmetical) { for(;i<strlen(syms);++i) { if(!((syms[i]>=0x28&&syms[i]<=0x2B)||(syms[i]>=0x30&&syms[i]<=0x39)||syms[i]=='-'||syms[i]=='/'||syms[i]=='=')) { printf("NO"); return; } if(syms[i]=='(') { if(syms[i+1]=='*') { ++i; comment=1; break; } ++brakets; } if(syms[i]==')') { --brakets; if(!brakets) { arithmetical=0; break; } } } continue; } for(;i<strlen(syms);++i) { if(syms[i]=='(') { if(syms[i+1]=='*') { ++i; comment=1; break; } ++brakets; arithmetical=1; break; } if(syms[i]==')') { printf("NO"); return; } } } if(comment||arithmetical) { printf("NO"); return; } printf("YES"); } why wa 26? (*(**)*) must be "YES" or "NO"? must be "NO". i find the mistake.it seems, test contains the limit of text in one line. Edited by author 25.06.2011 17:34 Edited by author 25.06.2011 17:35 |
WA1 | Gelioscope | 1027. D++ Again | 25 Jun 2011 00:55 | 2 |
WA1 Gelioscope 24 Jun 2011 20:10 This is my code: #include <stdio.h> #define ulong unsigned long void main() { #ifndef ONLINE_JUDGE freopen("in.txt","rt",stdin); freopen("out.txt","wt",stdout); #endif bool comment=0,arithmetical=0; long brakets=0; char syms[10001]; ulong i; while(!feof(stdin)) { gets(syms); i=0; while(syms[i]) { if(comment) { while(syms[i]) { if(syms[i]=='*') { ++i; if(syms[i]==')') { ++i; comment=0; break; } } ++i; } } if(arithmetical) { while(syms[i]) { if(!((syms[i]>=0x28&&syms[i]<=0x2B)||(syms[i]>=0x30&&syms[i]<=0x39)||syms[i]=='-'||syms[i]=='/'||syms[i]=='\n'||syms[i]=='=')) { printf("NO"); return; } if(syms[i]=='(') { ++i; if(syms[i]=='*') { ++i; comment=1; break; } ++brakets; continue; } if(syms[i]==')') { ++i; --brakets; if(!brakets) { arithmetical=0; break; } } ++i; } continue; } while(syms[i]) { if(syms[i]=='(') { ++i; if(syms[i]=='*') { ++i; comment=1; break; } arithmetical=1; ++brakets; break; } if(syms[i]==')') { printf("NO"); return; } ++i; } } } if(arithmetical||comment) { printf("NO"); return; } printf("YES"); } WHY WA1?! Re: WA1 Gelioscope 25 Jun 2011 00:55 Give me solution for this task, please, i don't understand why i get WA#1 |