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 1438. Time Limit Exceeded

before and after "+ - * / % =" maybe no blanks?
Posted by chenll 7 Mar 2006 13:05
My solution assumes that... (+)
Posted by Dmitry 'Diman_YES' Kovalioff 7 Mar 2006 13:14
All the operands, reserved words and operations are separated by spaces. More over, there are no spaces between label and ":" (i.e "label:", but not "label :"), and between number and its sign (i.e. "-4", but not "- 4").
Re: My solution assumes that... (+)
Posted by chenll 7 Mar 2006 13:51
then in these case:
<variable> = <varnum> + <varnum>
<variable> = <varnum> - <varnum>
<variable> = <varnum> * <varnum>
<variable> = <varnum> / <varnum>
<variable> = <varnum> % <varnum>
<variable> = <varnum> or <varnum>
<variable> = <varnum> and <varnum>
<variable> = <varnum> xor <varnum>

I read the fourth string operation, but found operation is not in the set of { +,-,*,/,%,and,or,xor}
Impossible (+)
Posted by Dmitry 'Diman_YES' Kovalioff 7 Mar 2006 14:11
I use case construction by the first symbol of operation: "+", "-", "*", "/", "%", "o", "a", "x". My solution would get crash otherwise. Did you assume that the operations and reserved words may be writen in upcase ("XoR", "aND", "gOTo", "pRiNT")?
Re: Impossible (+)
Posted by chenll 7 Mar 2006 19:06
I use the first character and got Accepted. like this:

if(operation[0]=='A' || operation[0]=='a')
  operation = "and";
else if(operation[0]=='X' || operation[0]=='x')
  operation = "xor";
else if(operation[0]=='O' || operation[0]=='o')
  operation = "or";


but I make the operation string to lower case and got WA.
like this:

string tmp="";
for(int i=0;i<operation.length();i++)
{
   if(operation[i]>='A' && operation[i]<='Z')
       tmp += tolower(operation[i]);
   else tmp+=operation[i];
}
operation=tmp;


But I really think if the operation string is "Xor" or "XOR" or "xOR" or "xor", the result is the same.
unless the operation string maybe something like "xoe".

Edited by author 07.03.2006 19:06

Edited by author 07.03.2006 19:06
My congratulations. You've done it (-)
Posted by Dmitry 'Diman_YES' Kovalioff 7 Mar 2006 21:43