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

Обсуждение задачи 1038. Проверка орфографии

ft ! I submit it nearly 20 times.But I also get wa? Could anyone help me ? Or give me some input which my prog give the wrong answer?OK?
Послано liuzhizhi 7 авг 2004 21:34
This is my program:
var
 total:longint;
procedure init;
 var
  a:char;
  start:boolean;
  w:longint;
 begin
  read(a);
  start:=true;
  w:=0;
  repeat
   if not(a in[' ',';',':','-',',']) then
    begin
     if a in['.','!','?'] then
      begin
       start:=true;
       w:=0;
      end else
     if a in['A'..'Z'] then
       begin
        if w<>0 then inc(total);
        if (w=0)and(start) then start:=false;
        inc(w);
       end else
     if a in['a'..'z'] then
      begin
       if start=true then
        begin
         inc(total);
         start:=false;
        end;
       inc(w);
      end;
    end else w:=0;
  read(a);
  until eof;
  writeln(total);
 end;

begin
 init;
end.
Re: ft ! I submit it nearly 20 times.But I also get wa? Could anyone help me ? Or give me some input which my prog give the wrong answer?OK?
Послано Sandro 9 авг 2004 14:03
I found your mistake.
"A word is a sequence of letters not containing any other symbols or ends of line."

But your program doesn't check the ends of lines. Try this test:

This sentence iz correkt! -It Has,No mista;.Kes et
oll. But there are two
BIG mistakes in this one!
and here is one more.

The answer is 3, but your program output 4. You can easily modify your program:

if not(a in[' ',';',':','-',',',#10]) then

and all must be fine.
Re: ft ! I submit it nearly 20 times.But I also get wa? Could anyone help me ? Or give me some input which my prog give the wrong answer?OK?
Послано zhizhiliu 9 авг 2004 14:09
thanks very much.
I got ac now.
It's very kind of you.