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 1365. Testing Calculator

Strange ???
Posted by Antonov Yuri (USU) 4 Aug 2005 17:21
Note:

"It means, that each subexpression is always evaluated in
the same way with no dependency on it's entrance into the whole expression."

CURRENT VERSION of Calculator:
Input:
(0)
(0)1
(0)1(0)1
(0)1(0)1(0)
(0)1(0)1(0)1
(0)1(0)1(0)1(0)
Output:
Expression 1 evaluates to: 0
Expression 2 evaluates to: 1
Expression 3 evaluates to: 101
Expression 4 evaluates to: 1010
Expression 5 evaluates to: 10101
Expression 6 evaluates to: 101010

comment : "Leading zeroes excluded"

PREVIOUS VERSION of Calculator:
Input:

(0)
(0)1
(0)1(0)1
(0)1(0)1(0)
(0)1(0)1(0)1
(0)1(0)1(0)1(0)

Output:
Expression 1 evaluates to: 0
Expression 2 evaluates to: 1
Expression 3 evaluates to: 11
Expression 4 evaluates to: 110
Expression 5 evaluates to: 111
Expression 6 evaluates to: 1110

According to the output of the CURRENT VERSION of calculator
!!! evaluation of subexpression depends on context

Am I right ???
Re: Strange ???
Posted by Aleksandr Klepinin 4 Aug 2005 18:05
The so called CURRENT VERSION of calculator works correctly (where do you see dependency on context? just notice that calculator operates on numbers, not on strings!)

In fact, calculator engine was updated a few days ago. An error was found there. :) That error was concerned with dependency on context (previous version, as it is mentioned above, evaluated 1(0)1 as 11 instead of 101) and it was fixed. Current logic of calculator is more predictable than the previous one.
"An error was found..." I like it :) (+)
Posted by Dmitry 'Diman_YES' Kovalioff 4 Aug 2005 19:54
If I'm not mistaken last time you've said such output was absolutely correct and advised me to learn calculator logic carefully ;)
Re: Strange ???
Posted by Antonov Yuri (USU) 4 Aug 2005 22:20
Sorry !!!
I made a foolish mistake !!!
Re: Strange ???
Posted by Antonov Yuri (USU) 4 Aug 2005 23:24
Thanks for the help !!!