|
|
Page 5 import java.io.*; public class Main { public static void main(String[] args) { PrintWriter out = new PrintWriter(System.out); out.print("YES"); out.flush(); } } Edited by author 26.10.2008 14:23 if you get it, check (*(*) YES very useful suggest!Thanks~ Edited by author 04.09.2009 12:23 Thank you. It helped me out. What is the input data in #10 test? Please help. Good morning. Please, anybody, give test #26. I have on this test "stack overflow". Thx a lot. This is test consist from many '(', if you use in your program stek then size of stek must be more then 255. [deleted] Edited by author 05.09.2008 16:18 Edited by author 05.09.2008 16:18 I solved this problem when I was awful newbie. Some days ago I tried to help my friend with it. I realized that my AC code is terrible and absolutely wrong))) But it's still AC. It made us burst out laughing))))) There are no clarifications about intersection of comments and arithmetical expressions in this problem. Here are some test my AC code produce: (() YES (1)(* YES (-)+ YES If rejudge occur I'd like to see neat statement to rewrite it correctly) 1) Answer is NO. Brackets have to be balanced. 2) Answer is NO. Comment is not closed. 3) Answer is YES. All correct. These tests and some more were added. About 140 solutions lost AC, but tests are still weak in this problem. Maybe new tests will be added. I think that Ac prog must be terrible and absolutely wrong because with n=10000 this problem impossible to solve. We must consider all possible unitersecting sets of segments of commentries and after apply to residues arithmetics expression rules. This collection of sets of commentry segments very big. Standard right way- recursion: We extract one possible commentry segment and apply same algo to residue. AC says me that authors used additional unsaid condition: each commentry '(*' ends on the FIRST closing '*)'. Without this I considered "(*)*)*)" As YES But now it NO. With additional condition the problem became very simple. Edited by author 12.11.2008 10:59 (*) yes (*()) yes (()*) yes ((*)*) yes (**(*)) yes )(()) no (*****8881-:) no (*****8881-+) yes (*(*(*(*) yes Edited by author 07.06.2008 01:41 (*) NO (*()) NO (()*) yes ((*)*) no (**(*)) no )(()) no (*******8881-:) no (*******8881-+) no (*(*(*(*) yes ((**)*))*) - and what about this? Is this example possible? ((*123+-890)) ((*123+-890)) NO Edited by author 09.07.2009 15:40 >(*) NO >(*()) NO >(()*) yes >((*)*) no >(**(*)) no >)(()) no >(*******8881-:) no >(*******8881-+) no >(*(*(*(*) yes Thanks, these examples really helped me to AC my code has WA#1 with "while not eof do" and with "while not eoln do" WA#4. i do to input this
Function Key:char; var c:char; begin; if not eof then read(c) else cor:=false; key:=c; end; but i have WA 1 when i write first test in my own my program output 'YES' What shall i do to realize input correct P.S. I read FAQ, it didn't help me in my problem Edited by author 21.02.2008 23:54 why it is wrong? "An arithmetic expression in D++ is always opened by "(", is closed by ")" and may contain any of the following symbols: "=+-*/0123456789)("" arithmetic expression is opened by '(',may contain '*'and closed by ')'.so "(*)" can seen as a right arithmetic expression. anyone can answer me?? my AC'ed solution says that (*) is NOT a legal expression. Either the test set does not have such things, or judges do not consider (*) to be an arithmetic expr An arithmetic expression can't start with a pair of symbols "(*" In my opinion, (*) is valid COMMENTARY - it's opened by (* and closed by *) ; I think we need to add "and these two pairs of symbols should not intersect" to this phrase in statement - " A comment is always opened by a pair of symbols "(*" and is closed by a pair of symbols "*)" , otherwise (*) is YES for sure. Edited by author 16.02.2010 13:52 In my opinion, (*) is valid COMMENTARY - it's opened by (* and closed by *) ; I think we need to add "and these two pairs of symbols should not intersect" to this phrase in statement - " A comment is always opened by a pair of symbols "(*" and is closed by a pair of symbols "*)" , otherwise (*) is YES for sure. You is very crazy man :) I think, that you never write syntax analyzer for languages. You "additional condition" is obvious for all, that ever write syntax analyzers, but not for you. :) This problem is about syntax analyzer , NOT working with any string and substrings. Edited by author 16.02.2010 21:12I got crash on test#12 the first line of this test if empty. so if you readln(s) and delete(s,1,1) it'll crash. good luck please suggest some test cases??? (*(*(*) (*))))(((((*) (12344+ 7899*) fghjjjf () sdcsdc (()) jlkjlkj((*)) my AC prog output NO bit if try: (*(*(*) (*))))(((((*) (12344+ 7899*) fghjjjf () sdcsdc (()) jlkjlkj((1*)) answer is YES I meet this trouble too, I don't know why Help please! I want to solve this problem, my program pass all the tests I've found in this forum successful! Why I've got WA on test 1! TELL ME PLEASE about this test! I can't understand what is wrong in my program! P.S. My program pass these tests correctly: (*) - NO (*(*) - YES (**) - YES (*8*)*) - NO ( - NO ())(D - NO (123 321) - YES (1+2+3 ) - YES qe()eq - YES q(())q - YES 45(798+- )(**)() - YES And task example text pass successful too. Explain me please what is test 1. I can't solve this problem without this information. First test must be example test, so check your input/output first. P.S. This program passed test #1 #include <stdio.h> int main() { printf("YES\n"); return 0; } Edited by author 06.01.2008 12:52 It's very strange. My program outputs 'YES' or 'NO', it's correct. But maybe I should read input data from text file? My current program reads input data in a cycle ('while') and reads it for symbols one by one. Here is fragment of my code which reads input data. Answer me please, is it correct? while( not eof ) do begin read( c );
//... end; I've verified, such reading method is correct. So, I can't understand where I've done a mistake. My program outputs YES while passing the example test. But I always get WA on test 1. Give me please the first test, I must solve this problem. problem said that only \r (carrige return) occured in arithmatic statement , but \n is necessary for this statement too. \n used in test#1. good luck Thank you ,now my program can past 1 to 4 ,but can't Wrong Answer on the 5 test case! the test used \n test this: 45(798+- )(**)() the answer is : YES Thank you, sahand! my mistake was not in '\n', but I found it!! now I have AC Why I got WA on test #1 ? My program works correctly for all the test I've found on this forum! What is test #1 ? Please help or I'll become a crazy man! Can anybody explain me why such a construction as (**) must be understood by my program as not correct? According to my mind, this construction is an empty comment. So, why it isn't a correct construction? Sorry, this construction is correct, I've been disappeared by one of topics in this forum. Topic is closed. P.S. Sorry for my English. |
|
|