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

Обсуждение задачи 1102. Странный диалог

Can I use Pascal and DP to get AC?If possible,how?If impossible how?
Послано CO2 17 июл 2004 14:38
If I use Pascal,I found the "read" takes too long time.In C,we can use "getc".But in pascal,I don't know how to do.
Is there any algo better than Dp? What does DFA meant?
Could you give me some hint or a good algo?
Thanks for your help.
Waiting for RE.
I solved it reading char by char in 0.578 secs. I think, your DP is too slow. Check $I directive.
Послано Vlad Veselov [PMG17, Vinnitsa - KNU, Kiev] 17 июл 2004 16:32
Re: What does DFA meant?
Послано BYF 30 авг 2004 16:20
就是有限状态自动机。
Nor can I solve it by Dp.
Послано IceWorld 7 мар 2005 13:50
const
    Inf         ='';
    Outf        ='';
    max            =10;
var
    n            :integer;

Procedure main;
var
    i,j,k       :integer;
    s,bool      :string[max+2];
    alp            :set of char;
    c            :char;
begin
    assign(input,Inf); reset(inpuT);
    assign(output,Outf); rewrite(output);
    readln(n);
    alp:=['p','u','t','o','i','n','e'];
    for i:=1 to n do
    begin
        k:=0;
        s:='';
        bool:='1';
        while not(eoln) do
        begin
            if length(s)>max then begin delete(s,1,1); delete(bool,1,1); end;
            read(c);
            if not(c in alp) then begin bool:='0'; break; end;
            s:=s+c;
            if (c='n') and (length(s)>1) then if (copy(s,length(s)-1,2)='in') and (bool[length(bool)-1]='1')
                then begin bool:=bool+'1'; continue end;
            if (c='n') and (length(s)>4) then if (copy(s,length(s)-4,5)='puton') and (bool[length(bool)-4]='1')
                then begin bool:=bool+'1'; continue end;
            if (c='t') and (length(s)>2) then if (copy(s,length(s)-2,3)='out') and (bool[length(bool)-2]='1')
                then begin bool:=bool+'1'; continue end;
            if (c='t') and (length(s)>4) then if (copy(s,length(s)-4,5)='input') and (bool[length(bool)-4]='1')
                then begin bool:=bool+'1'; continue end;
            if (c='t') and (length(s)>5) then if (copy(s,length(s)-5,6)='output') and (bool[length(bool)-5]='1')
                then begin bool:=bool+'1'; continue end;
            if (c='e') and (length(s)>2) then if (copy(s,length(s)-2,3)='one') and (bool[length(bool)-2]='1')
                then begin bool:=bool+'1'; continue end;
            bool:=bool+'0';
        end;
        if bool[length(bool)]='1' then writeln('YES')
        else writeln('NO');
        readln(s);
    end;
    close(output);
    close(Input);
end;

begin
    main;
end.
CO2 писал(a) 17 июля 2004 14:38
If I use Pascal,I found the "read" takes too long time.In C,we can use "getc".But in pascal,I don't know how to do.
Is there any algo better than Dp? What does DFA meant?
Could you give me some hint or a good algo?
Thanks for your help.
Waiting for RE.
Using strings makes it too slow...
Послано Ves 8 мар 2005 05:34
Re: What does DFA meant?
Послано ronobe (aka oberon) 8 мар 2005 17:54
I suppose that this means Deterministic Finite Automat.

> 就是有限状态自动机。
Ну шо тебе ответить
Re: What does DFA meant?
Послано lengyue2005 8 июн 2005 13:58
ER~ I'M CHINESE TOO .BUT I DON'T KNOW WHAT DOES "有限状态自动机"MEAN.CAN YOU SAY MORE ABOUT IT??
Re: Can I use Pascal and DP to get AC?If possible,how?If impossible how?
Послано Yu Yuanming 8 июн 2005 17:19
Of course Pascal is OK.
I got AC simply use "read"

DP isn't a good way in this problem,I think.
You can go to  oibh.ioiforum.org  to find some useful tips.