The easiest problem ever !!

Look at this Pascal pseudocode program

 i := 0; temp := 0;
 while (i <= n) do
 begin
      dec(i);
      inc(temp);
 end;
 writeln(temp);

What will the program do ?

I even don't know Write the number n Time Limit Exceeded Compile Error Write the number n+1

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Jansen Wu
Mar 19, 2015

If you see the program properly, you'll find that the program never end.
And because the program never end, so the answer is Time Limit Exceeded

No, numbers will overflow and temp become maximal int and program will stop.

Hasmik Garyaka - 3 years, 8 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...