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

Обсуждение задачи 1201. Какой сегодня день?

whi i dot WA. please help me?here is a my program.
Послано I am david. Tabo. 26 май 2002 12:39
uses  crt;
const b:array [1..7] of string=
('mon','tue','wed','thu','fri','sat','sun');
      v:array [1..12] of shortint=
(31,28,31,30,31,30,31,31,30,31,30,31);

var v1,data,month,year,l,t,r,n,i,j,k,x:integer;
    z:string;
    p:boolean;
    d:array [1..7,1..7] of string;

procedure readdata;
  begin
    clrscr;
    readln (data,month,year);
  end;

function leap(i:word):boolean;
  begin
    leap:=((i mod 4=0)and(i mod 100<>0))or(i mod 400=0);
  end;

procedure first_jan_of_year;
  begin
    j:=0;
    for i:=1 to year do
      begin
        if leap(i) then
          j:=(j+2) mod 7
        else
          j:=(j+1) mod 7;
      end;
  end;

procedure find_first_day;
  begin
    for i:=1 to month-1 do
      if (leap(year)) and (i=2) then
        k:=k+29
      else
        k:=k+v[i];
    if k<>0 then
      begin
        k:=k mod 7;
        if k=0 then
          k:=7;
      end;
    j:=(j+k) mod 7;
    if j=0 then
      j:=7;
    if year=1600 then
      j:=6;
  end;

procedure how_many_day_are_in_the_month;
  begin
    if (leap(year)) and (month=2) then
      x:=29
    else
      x:=v[month];
  end;

procedure weeks_days;
  begin
    d[1,1]:='mon';d[2,1]:='tue';
    d[3,1]:='wed';d[4,1]:='thu';
    d[5,1]:='fri';d[6,1]:='sat';
    d[7,1]:='sun';
  end;

procedure make_calendar;
  begin
    r:=0;
    for l:=2 to 7 do
      for i:=j to 7 do
        begin
          inc (r);
          if r>x then
            exit;
           str (r,d[i,l]);
           if r=data then
             begin
               if (length(d[i,l])=2) then
                 begin
                   d[i,l]:='['+d[i,l]+']';
                   d[i,l]:='  '+d[i,l];
                 end
               else
                 begin
                   d[i,l]:='[ '+d[i,l]+']';
                   if d[i,l-1]='' then
                     begin
                       d[i,l-1]:='    ';
                       d[i,l]:='  '+d[i,l];
                     end
                   else
                     if (d[i,l-1]='mon')or(d[i,l-1]='tue')or(d[i,l-1]
='wed')or
                        (d[i,l-1]='thu')or(d[i,l-1]='fri')or(d[i,l-1]
='sat')or(d[i,l-1]='sun') then
                        d[i,l]:=' '+d[i,l]
                     else
                       d[i,l]:='  '+d[i,l];
                 end;
             end
           else
             begin
               if d[i,l-1]='' then
                 begin
                   d[i,l-1]:='    ';
                   d[i,l]:='    '+d[i,l];
                 end
               else
                 begin
                   if length(d[i,l])=2 then
                     begin
                       if d[i,l-1][length(d[i,l-1])]=']' then
                         d[i,l]:='  '+d[i,l]
                       else
                         d[i,l]:='   '+d[i,l]
                     end
                   else
                     if L=2 then
                       d[i,l]:='   '+d[i,l]
                     else
                       if (l=3)and(length(d[i,l])=1)and(d[i,l-1]
[length(d[i,l-1])]=']') then
                         d[i,l]:='   '+d[i,l]
                       else
                         d[i,l]:='    '+d[i,l];
                 end;
             end;
           if i=7 then
             j:=t+1;
        end;
  end;

procedure print;
  begin
    for i:=1 to 7 do
      for j:=1 to 8 do
        if j>7 then
          writeln
        else
          write (d[i,j]);
  end;

procedure check_calendar;
  begin
    str (x,z);
    l:=pos(z,d[7,6]);
    if (data=29)or(data=30)or(data=31) then
      v1:=1;
    if l=0 then
      for i:=1 to 7 do
        for j:=1 to 7 do
          if (v1=1)and(d[i,j]='') then
            d[i,j]:='      '
          else
            if (d[i,j]='') then
              d[i,j]:='     ';
    if (d[1,7]='     ')or(d[1,7]='      ') then
Re: whi i dot WA. please help me?here is a my program.
Послано ECUST Multistar 26 май 2002 18:21
I had correct your problem and send a E-mail to you.