ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1059. Expression

Show all messages Hide all messages

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.
Does it mean that your solution is wrong? Nazarov Denis (nsc2001@rambler.ru) 23 Feb 2002 20:24
> 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.
>