ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1438. Time Limit Exceeded

before and after "+ - * / % =" maybe no blanks?
Послано chenll 7 мар 2006 13:05
My solution assumes that... (+)
Послано Dmitry 'Diman_YES' Kovalioff 7 мар 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... (+)
Послано chenll 7 мар 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 (+)
Послано Dmitry 'Diman_YES' Kovalioff 7 мар 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 (+)
Послано chenll 7 мар 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 (-)
Послано Dmitry 'Diman_YES' Kovalioff 7 мар 2006 21:43