| Show all threads     Hide all threads     Show all messages     Hide all messages | 
| Hint. | some_programming_novice | 1059. Expression | 29 Dec 2019 07:19 | 1 | 
| Hint. some_programming_novice 29 Dec 2019 07:19 | 
| I don't understand the statement | mouse_wireless2 | 1059. Expression | 26 Mar 2018 11:13 | 1 | 
| 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?
 | 
| Just to know | johny ca$h | 1059. Expression | 27 Jun 2017 23:08 | 1 | 
| There are no tests where N=0 xD) | 
| How to get AC | OleGG | 1059. Expression | 2 Feb 2010 20:28 | 2 | 
| 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)
 | 
| Examples | Ildar Valiev | 1059. Expression | 25 Mar 2009 01:14 | 3 | 
| Input: 2Ouput: 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
 | 
| I got AC. This is my program | Aleksey S.S. | 1059. Expression | 21 Jul 2005 15:41 | 3 | 
| >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 | 
| I think this is O(n) | PTD_PDP | 1059. Expression | 19 Sep 2004 22:34 | 2 | 
| Just out put:n
 x
 n-1
 x
 .
 .
 .
 1
 x
 0
 *
 +
 *
 +
 .
 .
 .
 *
 +
 
 (n sign + and n sign *)
 
 And AC, right
 | 
| <FONT COLOR="Red">What did the matter with timer???</FONT> | Vlad Veselov | 1059. Expression | 3 Jun 2003 18:40 | 1 | 
| 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???!!!
 | 
| begin write(1); end. | MirTrud May | 1059. Expression | 14 May 2003 17:00 | 1 | 
| I got AC with this code:begin write(1); end.
 | 
| Do not seek any kind of logic in this problem just paste this! (+) | nullman | 1059. Expression | 18 Jan 2003 23:09 | 1 | 
| I think that there must be some 'X' one after another, because it issaid '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;
 }
 /////////////////////////////////////////////////
 | 
| No AC since 19-Feb-2002 (Even program that got AC on 18-Feb-2002 gets now WA) | Ilya Korniyko | 1059. Expression | 28 Nov 2002 00:17 | 5 | 
| Re: Ivan Georgiev 27 Mar 2002 00:44 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.
 >
 >
 | 
| THIS IS THE RIGHT SOLUTION FOR THIS PROBLEM | Juri Krainjukov | 1059. Expression | 28 Nov 2002 00:09 | 1 | 
| 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.
 
 | 
| Is the testdata changed? I submit a solved program many times, but always get wa | aaakkk | 1059. Expression | 28 Nov 2002 00:08 | 7 | 
| Who Can Post a just-solved program, I think it is hard to solve thisproblem 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.
 >
 
 | 
| Read it, please. | SPb SU #3 - 1 | 1059. Expression | 20 Aug 2002 16:46 | 3 | 
| 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";
 }
 | 
| The first test is n=1, and sample output gives WA | Ilya Korniyko | 1059. Expression | 16 Apr 2002 14:05 | 2 | 
| 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.
 | 
| I don't understand what's wrong with this problem!!! | ECUST Multistar | 1059. Expression | 26 Mar 2002 19:24 | 2 | 
| >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
 | 
| To admins: something's really wrong with 1059 | Ivan Georgiev | 1059. Expression | 22 Mar 2002 21:36 | 1 | 
| 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.
 | 
| Why n=2 it isn't ... | CleverKid | 1059. Expression | 12 Mar 2002 17:50 | 7 | 
| 0X
 *
 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
 >
 >
 | 
| Can anyone post a AC solution. PLEASE. | Gruber Matei (gruber@go.ro) | 1059. Expression | 26 Feb 2002 19:32 | 2 | 
| I tried more than 3 versions of the prog, including one which wroteone 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.
 >
 | 
| Can anyone post a AC solution. PLEASE. | Gruber Matei (gruber@go.ro) | 1059. Expression | 26 Feb 2002 01:33 | 1 | 
| I tried more than 3 versions of the prog, including one which wroteone 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.
 |