Help me!!Why I got WA?(pascal) Послано New CD 27 ноя 2002 09:50 program ti; var year,day,month,week:longint; p:boolean; function rrr(year:integer):boolean; var pd:boolean; begin pd:=false; if year mod 100=0 then begin if year mod 400=0 then pd:=true; end else if year mod 4=0 then pd:=true; rrr:=pd; end; procedure yyy(num,start,ending:integer); var i:longint; begin for i:=start to ending do begin week:=week+num; if rrr(i) then week:=week+num; if week<1 then week:=week+7; if week>7 then week:=week-7; end; end; procedure clcl; var i:longint; begin if year>2002 then yyy(1,2002,year-1) else if year<2002 then yyy(-1,year,2001); for i:=1 to month-1 do begin case i of 1,3,5,7,8,10: week:=week+3; 2: if p then week:=week+1; 4,6,9,11: week:=week+2; end; if week>7 then week:=week-7; end; end; procedure scsc; var max,i,j,l,q:longint; st:string; a:array[1..7,1..35]of char; begin case month of 1,3,5,7,8,10,12: max:=31; 2: if p then max:=29 else max:=28; 4,6,9,11: max:=30; end; a[1,1]:='m'; a[1,2]:='o'; a[1,3]:='n'; a[2,1]:='t'; a[2,2]:='u'; a[2,3]:='e'; a[3,1]:='w'; a[3,2]:='e'; a[3,3]:='d'; a[4,1]:='t'; a[4,2]:='h'; a[4,3]:='u'; a[5,1]:='f'; a[5,2]:='r'; a[5,3]:='i'; a[6,1]:='s'; a[6,2]:='a'; a[6,3]:='t'; a[7,1]:='s'; a[7,2]:='u'; a[7,3]:='n'; for i:=1 to 7 do for j:=4 to 35 do a[i,j]:=' '; l:=1; q:=3; for i:=1 to max do begin str(i,st); if (7-week+i>9)and(i<10) then st:=' '+st; if l=2 then begin q:=7; l:=1; end; if l=3 then q:=2; for j:=1 to length(st) do begin a[week,(l-1)*5+3+j+q]:=st[j]; end; if day=i then begin a[week,(l-1)*5+3+q]:='['; a[week,(l-1)*5+3+q+length(st)+1]:=']'; end; week:=week+1; if week>7 then begin week:=week-7; l:=l+1; if (q=7)and(l=2) then l:=l+1; end; if i=max then begin q:=(l-1)*5+3+length(st)+q; if day=max then q:=q+1; end; end; for i:=1 to 7 do begin for j:=1 to q do write(a[i,j]); writeln; end; end; begin read(day,month,year); week:=2; p:=rrr(year); clcl; scsc; end. Publish your Email I will send my AC > program ti; > var year,day,month,week:longint; > p:boolean; > > function rrr(year:integer):boolean; > var pd:boolean; > begin > pd:=false; > if year mod 100=0 then begin if year mod 400=0 then pd:=true; > end > else if year mod 4=0 then pd:=true; > rrr:=pd; > end; > > procedure yyy(num,start,ending:integer); > var i:longint; > begin > for i:=start to ending do begin > week:=week+num; > if rrr(i) then week:=week+num; > if week<1 then week:=week+7; > if week>7 then week:=week-7; > end; > end; > > procedure clcl; > var i:longint; > begin > if year>2002 then yyy(1,2002,year-1) > else if year<2002 then yyy(-1,year,2001); > > for i:=1 to month-1 do begin > case i of > 1,3,5,7,8,10: week:=week+3; > 2: if p then week:=week+1; > 4,6,9,11: week:=week+2; > end; > if week>7 then week:=week-7; > end; > end; > > procedure scsc; > var max,i,j,l,q:longint; > st:string; > a:array[1..7,1..35]of char; > begin > case month of > 1,3,5,7,8,10,12: max:=31; > 2: if p then max:=29 > else max:=28; > 4,6,9,11: max:=30; > end; > a[1,1]:='m'; a[1,2]:='o'; a[1,3]:='n'; > a[2,1]:='t'; a[2,2]:='u'; a[2,3]:='e'; > a[3,1]:='w'; a[3,2]:='e'; a[3,3]:='d'; > a[4,1]:='t'; a[4,2]:='h'; a[4,3]:='u'; > a[5,1]:='f'; a[5,2]:='r'; a[5,3]:='i'; > a[6,1]:='s'; a[6,2]:='a'; a[6,3]:='t'; > a[7,1]:='s'; a[7,2]:='u'; a[7,3]:='n'; > for i:=1 to 7 do > for j:=4 to 35 do a[i,j]:=' '; > l:=1; > q:=3; > for i:=1 to max do begin > str(i,st); > if (7-week+i>9)and(i<10) then st:=' '+st; > if l=2 then begin q:=7; l:=1; end; > if l=3 then q:=2; > for j:=1 to length(st) do begin > a[week,(l-1)*5+3+j+q]:=st[j]; > end; > if day=i then begin > a[week,(l-1)*5+3+q]:='['; > a[week,(l-1)*5+3+q+length(st)+1]:=']'; > end; > week:=week+1; > if week>7 then begin > week:=week-7; > l:=l+1; > if (q=7)and(l=2) then l:=l+1; > end; > if i=max then begin > q:=(l-1)*5+3+length(st)+q; > if day=max then q:=q+1; > end; > end; > for i:=1 to 7 do begin > for j:=1 to q do write(a[i,j]); > writeln; > end; > end; > > begin > read(day,month,year); > week:=2; > p:=rrr(year); > clcl; > scsc; > end. Re: Help me!!Why I got WA?(pascal) There are two things to pay attention to: You should not use '.' character, but spaces(read carefully) and the second - if you have to highlight a one-digit number - you should do it like this: [ 6] and your program makes it [6]. Understand the difference? Anyway, here is my AC program, test yours!!! Good Luck! Re: Help me!!Why I got WA?(pascal) Послано New CD 28 ноя 2002 06:37 > There are two things to pay attention to: You should not use '.' > character, but spaces(read carefully) and the second - if you have > to highlight a one-digit number - you should do it like this: > [ 6] and your program makes it [6]. Understand the difference? > Anyway, here is my AC program, test yours!!! > Good Luck! But Послано New CD 28 ноя 2002 06:42 > There are two things to pay attention to: You should not use '.' > character, but spaces(read carefully) and the second - if you have > to highlight a one-digit number - you should do it like this: > [ 6] and your program makes it [6]. Understand the difference? > Anyway, here is my AC program, test yours!!! > Good Luck! Which is right?? mon [1] 8 15 22 29 tue 2 9 16 23 30 wed 3 10 17 24 31 thu 4 11 18 25 fri 5 12 19 26 sat 6 13 20 27 sun 7 14 21 28 mon [ 1] 8 15 22 29 tue 2 9 16 23 30 wed 3 10 17 24 31 thu 4 11 18 25 fri 5 12 19 26 sat 6 13 20 27 sun 7 14 21 28 mon [ 1] 8 15 22 29 tue 2 9 16 23 30 wed 3 10 17 24 31 thu 4 11 18 25 fri 5 12 19 26 sat 6 13 20 27 sun 7 14 21 28 Re: Publish your Email I will send my AC Послано New CD 28 ноя 2002 06:44 Thank you very much! But I don't want to get your AC. Re: But I suppose number 2 is correct, i.e. you print it as usual just inserting the [ character. so, correct is mon [ 1] tue 2 wed 3 etc. Good Luck! I got WA again? Послано New CD 28 ноя 2002 18:01 > I suppose number 2 is correct, i.e. you print it as usual just > inserting the [ character. so, correct is > mon [ 1] > tue 2 > wed 3 > > etc. > > Good Luck! program ti; var year,day,month,week:longint; p:boolean; function rrr(year:integer):boolean; var pd:boolean; begin pd:=false; if year mod 100=0 then begin if year mod 400=0 then pd:=true; end else if year mod 4=0 then pd:=true; rrr:=pd; end; procedure yyy(num,start,ending:integer); var i:longint; begin for i:=start to ending do begin week:=week+num; if rrr(i) then week:=week+num; if week<1 then week:=week+7; if week>7 then week:=week-7; end; end; procedure clcl; var i:longint; begin if year>2002 then yyy(1,2002,year-1) else if year<2002 then yyy(-1,year,2001); for i:=1 to month-1 do begin case i of 1,3,5,7,8,10: week:=week+3; 2: if p then week:=week+1; 4,6,9,11: week:=week+2; end; if week>7 then week:=week-7; end; end; procedure scsc; var max,i,j,q:longint; st:string; a:array[1..7,1..35]of char; begin case month of 1,3,5,7,8,10,12: max:=31; 2: if p then max:=29 else max:=28; 4,6,9,11: max:=30; end; a[1,1]:='m'; a[1,2]:='o'; a[1,3]:='n'; a[2,1]:='t'; a[2,2]:='u'; a[2,3]:='e'; a[3,1]:='w'; a[3,2]:='e'; a[3,3]:='d'; a[4,1]:='t'; a[4,2]:='h'; a[4,3]:='u'; a[5,1]:='f'; a[5,2]:='r'; a[5,3]:='i'; a[6,1]:='s'; a[6,2]:='a'; a[6,3]:='t'; a[7,1]:='s'; a[7,2]:='u'; a[7,3]:='n'; for i:=1 to 7 do for j:=4 to 35 do a[i,j]:=' '; q:=3; for i:=1 to max do begin str(i,st); if (i<10)and(7-week+i>9) then st:=' '+st; for j:=1 to length(st) do begin a[week,q+3+j]:=st[j]; end; if day=i then begin a[week,q+1+length(st)]:='['; a[week,q+4+length(st)]:=']'; end; week:=week+1; if week>7 then begin week:=week-7; if i>9 then q:=q+5 else q:=q+4; end; if i=max then begin if week<7 then q:=q+5; end; end; for i:=1 to 7 do begin for j:=1 to q do write(a[i,j]); writeln; end; end; begin read(day,month,year); week:=2; p:=rrr(year); clcl; scsc; end. Re: I got WA again? Hey man check this: 28 11 2002 !!! :) It just does not highlight anything and writes not full solution!!! Good Luck! I got AC.Thanks a lot!! Послано New CD 29 ноя 2002 05:12 Thank you. I got AC.Thanks a lot!! Послано New CD 29 ноя 2002 05:12 Thank you. |