Why isn't the output for 1 just: 1 ? It is equivalent to: 0 X * 1 + ... but it is shorter. The problem asks for minimal length doesn't it? There are no tests where N=0 xD) Well, everybody here knows, that best scheme is 0(X*i+) . But lot of us get WA1. I've found why we fail like this. The last line of output shouldn't contain line break, so I've changed string "X\n*\ni\n+\n" to "\nX\n*\ni\n+" and got AC. OMG. It is very strange :) for (int i = 1; i <=n; i++ ){ out.printf("X%n*%n%d%n+%n",i); } (Java) Input: 2 Ouput: 0 X X * * 1 X * 2 + + Input: 3 Output: 0 X X X * * * 1 X X * * 2 X * 3 + + + Input: 4 Output: 0 X X X X * * * * 1 X X X * * * 2 X X * * 3 X * 4 + + + + In mathematics it's right, but here I'd got WA 2. Why? >>>>Output should contain a sequence of minimal length your output could has not minimal length OK, I'd got AC. Here right examples: Input: N = 2 Output: 0 X * 1 + X * 2 + Input: N = 3 Output: 0 X * 1 + X * 2 + X * 3 + And so on. Edited by author 25.03.2009 20:20 > This is my solution: --------------program----------------- var n:integer; i:integer; begin readln(n); if n=0 then writeln(0) else begin writeln('0'); writeln('X'); writeln('*'); for i:=1 to n-1 do begin writeln(i); writeln('+'); writeln('X'); writeln('*'); end; writeln(n); writeln('+'); send; end. --------------------------------------- My program is just the same!!!! It's realy easy task! As easy as task №1000 Just out put: n x n-1 x . . . 1 x 0 * + * + . . . * + (n sign + and n sign *) And AC, right I readed MirTrudMay message, sended his solution and got AC(0.02 sec, 28K). Then I wrote my solution Program Task1059; Const First : String = 'X0*1+'; Var I,N : Word; BEGIN ReadLn(N); For I := 1 To 5 Do WriteLn(First[I]); For I := 2 To N Do begin WriteLn('X'); WriteLn('*'); WriteLn(I); WriteLn('+'); end; END. and got AC to, but 0.01 sec, 28K. Paradox???!!! I got AC with this code: begin write(1); end. I think that there must be some 'X' one after another, because it is said 'ai*X^(n-1)' like this for n=2: 0 X X * * 1 --> I'm only not quite sure for this '1' X * --> and if there is no '1' this row also turns off + 2 + I have tried to write something but it sucked, so I got a Pascal code and turned it to C++! AC 0.02 sec /////////////////////////////////////////////// // 1059 #include <stdio.h> int i,n; int main() { scanf("%d",&n); puts("0"); for (i=1;i<=n;i++) printf("X\n*\n%d\n+\n",i); //getch(); return 0; } ///////////////////////////////////////////////// I agree with you. I am trying to get AC.. all possible ways; It is obvious that the solution uses Horner's scheme the output is ambiguous: for example for n = 2 the following two outputs are correct: 2 1 0 * X + * X + 0 X * 1 + X * 2 + so which one to output ? I've tried both but WA; I really think the admins should recheck this problem's tests.. and clarify the problem's description. For instanse, your first output written in usual way looks like that: 2*(1*0+X)+X that is equal to 2*1*0+2*X+X I don't think it resembles the true output very much. > I agree with you. > I am trying to get AC.. all possible ways; > > It is obvious that the solution uses Horner's scheme > > the output is ambiguous: for example > > for n = 2 the following two outputs are correct: > > 2 > 1 > 0 > * > X > + > * > X > + > > 0 > X > * > 1 > + > X > * > 2 > + > > so which one to output ? I've tried both but WA; > > I really think the admins should recheck this problem's tests.. > and clarify the problem's description. > > I lately got AC for this var N:integer; i:integer; begin readln(N); if n=0 then writeln(0) else begin writeln('0'); writeln('X'); writeln('*'); for I:=1 to n-1 do begin writeln(i); writeln('+'); writeln('X'); writeln('*'); end; writeln(n); writeln('+'); end; end. Who Can Post a just-solved program, I think it is hard to solve this problem now. Here's my code which got AC before ... Program Polynom; Var i,n:Word; Begin Readln(n); Writeln(0); For i:=1 To n Do Begin Writeln('x'); Writeln('*'); Writeln(i); Writeln('+'); End; End. > Here's my code which got AC before ... > > Program Polynom; > Var i,n:Word; > Begin > Readln(n); > Writeln(0); > For i:=1 To n Do Begin > Writeln('x'); > Writeln('*'); > Writeln(i); > Writeln('+'); > End; > End. > > > Here's my code which got AC before ... > > > > Program Polynom; > > Var i,n:Word; > > Begin > > Readln(n); > > Writeln(0); > > For i:=1 To n Do Begin > > Writeln('x'); > > Writeln('*'); > > Writeln(i); > > Writeln('+'); > > End; > > End. > > In fact, this solution is really wrong. I don't understand how it could get AC before. I got AC lately for this problem. This is my solution: var N:integer; i:integer; begin readln(N); if n=0 then writeln(0) else begin writeln('0'); writeln('X'); writeln('*'); for I:=1 to n-1 do begin writeln(i); writeln('+'); writeln('X'); writeln('*'); end; writeln(n); writeln('+'); end; end.
And that is all... My code is almost identical, but... program expression; var i,j:word; begin readln(j); writeln(0); for i := 1 to j do begin writeln('X'); writeln('*'); writeln(i); writeln('+'); end; end. It gets Wrong Answer no matter whether the variables are integers or words(the data types) . Does anyone know what is wrong with my code? Also, if you have this problem accepted, i'll be most grateful if u posted the source codes here, since i havent the faintest idea what the question says and wants > Here's my code which got AC before ... > > Program Polynom; > Var i,n:Word; > Begin > Readln(n); > Writeln(0); > For i:=1 To n Do Begin > Writeln('x'); > Writeln('*'); > Writeln(i); > Writeln('+'); > End; > End. > I think that if there are more than 1 tests to task, my program simultaneously start all of this, and they say the result of first wrong. If so, I can say that my program (the same with old right solution) generates WA for N == 1 ! My output is the same with example but WA! I tried very many things to get AC. I failed. If tests or task was changed, change example, please! In any case, there is a mistake on TIMUS. Can anybody write me (o_09@star.math.spbu.ru) who can fix this mistake? I send many letters to acm.timus.ru but no answer. I think there are many people who tried to solve this problem for a lot of time. I know at least 11 persons (exclude me). This is so bad, that I have no words. Who can advise me something? Spb SU #9 - 1. here is my programme(in C++): #include <iostream.h> void main() { int n; cin>>n; cout<<0<<endl; for(int i=1;i<=n;i++) cout<<"X\n*\n"<<i<<"\n+\n"; } I submit this task for about 150 times. I tried also every possible things such as: every possible beginning and ending of sample output, empty file, and so on. I don't know what to do know. > Something is REALLY WRONG !!! No one could get Accepted after 17 Feb 2002, but before so many people did. I tried lots of possibilities of output (digits one per line,different operations) and could not either Program that got ACCEPTED on 18-Feb-2002 now always gets WA As far as I know the scheme of Horner: f (x) = an + x*(an-1 + x*(an-2 + ... gives the minimum operations needed to calculate the polynom is there something wrong with the input or output of this problem (the solution is obvious) Thank you. 0 X * 1 1 X * + + Why it isn't this? i think it's wrong. isn't it? > i think it's wrong. > isn't it? no,it's right i've got ac:) > > i think it's wrong. > > isn't it? > > no,it's right > i've got ac:) > > i think it's wrong. > > isn't it? > > no,it's right > i've got ac:) but then y dont they accept this? program expression; var i,j:integer; begin readln(j); writeln('0'); for i := 1 to j do begin writeln('x'); writeln('*'); writeln(i); writeln('+'); end; end. this is wrong answer but the output is the same for n=1 or 2 > > > i think it's wrong. > > > isn't it? > > > > no,it's right > > i've got ac:) > > but then y dont they accept this? > > program expression; > var i,j:integer; > > begin > readln(j); > writeln('0'); > for i := 1 to j do begin > writeln('x'); > writeln('*'); > writeln(i); > writeln('+'); > end; > end. > > this is wrong answer but the output is the same for n=1 or 2 p.s. it doesnt accept whether the x is upper or lower case > > I tried more than 3 versions of the prog, including one which wrote one char/line, one which wrote a number/line, etc. All of them got WA. I don't have the slightest idea what to do. If anyone got AC on this problem after the test data was modified, i would be grateful if he would post the source code. Thanx in advance. > I tried more than 3 versions of the prog, including one which wrote > one char/line, one which wrote a number/line, etc. All of them got > WA. > > I don't have the slightest idea what to do. If anyone got AC on this > problem after the test data was modified, i would be grateful if he > would post the source code. > > Thanx in advance. > I tried more than 3 versions of the prog, including one which wrote one char/line, one which wrote a number/line, etc. All of them got WA. I don't have the slightest idea what to do. If anyone got AC on this problem after the test data was modified, i would be grateful if he would post the source code. Thanx in advance. |
|