Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | Pay attention! | andreyDagger | 1201. Какой сегодня день? | 23 июл 2024 18:23 | 3 | January 1st 1600 is sunday, not monday! It's saturday, not sunday! here's the answer for 1 1 1600 mon 3 10 17 24 31 tue 4 11 18 25 wed 5 12 19 26 thu 6 13 20 27 fri 7 14 21 28 sat [ 1] 8 15 22 29 sun 2 9 16 23 30 | 1201 is stupid! | Dmitry 'Diman_YES' Kovalioff | 1201. Какой сегодня день? | 19 апр 2020 02:55 | 3 | Fucking participants! This problem is the most stupid problem I have ever seen. Why the problem is to output the calendar but not to find the day of week? It is very simple to find but it is IMPOSSIBLE to output! The sample does not give the answers to many questions. Why I MUST GUESS, GUESS and GUESS again? ... Diman_YES[UT], the leader of Universal Team I think, you're wrong. The format of output data is rather clear, and the only thing, not mentioned in the problem statement is that one has to output [.n] when current date is less than 10. IMHO problem 1177 is rather worse from this point of view. I think, you're wrong. The format of output data is rather clear, and the only thing, not mentioned in the problem statement is that one has to output [.n] when current date is less than 10. IMHO problem 1177 is rather worse from this point of view. Jesus Christ !!! I had thought that maybe that was why (putting a space to the left between the brackets when the number had a single digit) that WA had in test2, but I didn't believe it. In fact I assumed that in this problem the spaces were irrelevant. I find it terrible!, "[1]" incorrect and "[ 1] ([.1])" correct, for such nonsense one should not have a WA, much less if the problem does not specify it explicitly. And it is a pity because it is a beautiful problem. Thanks for clarifying this. | wa4 is feb (+) | ASK | 1201. Какой сегодня день? | 25 мар 2016 03:53 | 4 | 7 2 2000 mon......[.7]..14...21...28 tue...1....8...15...22...29 wed...2....9...16...23..... thu...3...10...17...24..... fri...4...11...18...25..... sat...5...12...19...26..... sun...6...13...20...27..... btw, to turn ' ' into '.', one can use sed 's/ /./g' You is good man! Thank you! Edited by author 02.09.2011 04:30 i have one to one answer, but anyway WA4, and only from C++, C# is fine... Oh... my bad, for 17 2 2000 was wrong by 1 symbol | WA 10 and I have no idea what could be wrong | MishaRash | 1201. Какой сегодня день? | 25 июл 2015 00:56 | 2 | I wrote the program on Python 3.4. The output for '30 1 2012' is mon........2....9...16...23..[30] tue........3...10...17...24...31 wed........4...11...18...25..... thu........5...12...19...26..... fri........6...13...20...27..... sat........7...14...21...28..... sun...1....8...15...22...29..... It should be right, but I still got WA. I think there is too few data about the output format in the problem statement. For example, I had to go to forum to get that there must be 4 spaces between first and second coulumn and no space in the end of the second line in this case. I rewrote the program on C (GCC) and found the problem. On '1 1 1600' I got mon........3...10...17...24 tue........4...11...18...25 wed........5...12...19...26 thu........6...13...20...27 fri........7...14...21...28 sat.[.1]...8...15...22...29 sun...2....9...16...23...30 My program calculated number of weeks in the month wrong. When I solved this, I got AC. Probably the 10th test is not '30 1 2012' any more. | Problem without problem statement!!! | [SPbSU ITMO] MAKAPOB | 1201. Какой сегодня день? | 21 июл 2015 22:27 | 3 | To admins: please add some rules, which format of output should be, because this example from one month shows me nothing. 1) number of spaces must be 3 everywhere except 1,2,3,4,5,6,7,8,9? 2) we must count day of week using normal calender? Rules about it are full, or some items are omitted??? 3) What is in test 10?? P.S. Is this correct for: 7 1 2006 mon.......2....9...16...23...30 tue.......3...10...17...24...31 wed.......4...11...18...25 thu.......5...12...19...26 fri.......6...13...20...27 sat.....[.7]..14...21...28 sun...1...8...15...22...29 Or correct is: mon........2....9...16...23...30 tue........3...10...17...24...31 wed........4...11...18...25 thu........5...12...19...26 fri........6...13...20...27 sat......[.7]..14...21...28 sun...1....8...15...22...29 ????? I mean number of spaces. Edited by author 03.03.2007 11:41 I think you should not count space characters but rather use alignment like in sample. The problem is that there is no information about this case in samples. | hint for WA 10 | BORODA | 1201. Какой сегодня день? | 8 фев 2014 19:24 | 1 | The answer for "30 1 2012": mon........2....9...16...23..[30] tue........3...10...17...24...31 wed........4...11...18...25..... thu........5...12...19...26..... fri........6...13...20...27..... sat........7...14...21...28..... sun...1....8...15...22...29..... between first and second column there are exactly 4(!) '.'; | WA2 | SazanovSasha | 1201. Какой сегодня день? | 12 июл 2013 15:37 | 2 | WA2 SazanovSasha 12 июл 2013 15:32 I have WA2, but I don't know why. What a trick in test 2? Or can you give me some tricky tests? Re: WA2 SazanovSasha 12 июл 2013 15:37 My mistake. I forgot to comment out the line. | To Admins : WA 10 | Andrew Sboev [USU] | 1201. Какой сегодня день? | 8 мар 2013 15:51 | 2 | Please, check this test(or checker) - my program passes all tests correctly(all 365 tests for non-leaps years and 366 for leap years), but WA 10, or say, if my solution gives a wrong answer at all :) Got AC after I did 4 spaces between 1-digit numbers and 3 spaces between day-name and first column... It's not very obvious, I think... | Very intersting | Aguero | 1201. Какой сегодня день? | 4 мар 2013 21:23 | 4 | If I get WA#10 then I'm not right, but all tests in the forum I solved correcyly! It is so strnage! If you have some idea about this, may you write me? thank's a lot fuck! my box is barcelonaaaa@yandex.ru I have the same situation with my program as Aguero. paul.martynov@gmail.com | WA#3 and leap year HELP!!! | sernas20 | 1201. Какой сегодня день? | 3 мар 2013 04:06 | 1 | What does the test WA#3? Help!!! And where does a leap year? : "Do not forget about the leap years." Can you please show an example of a test WA#3. I write (programmed in) to C#. Thanks in advance! Edited by author 03.03.2013 04:07 Edited by author 03.03.2013 16:50 | Pascal datetime behaving strangely? | lancs | 1201. Какой сегодня день? | 5 дек 2012 19:43 | 1 | [edit] I used formula for day of week instead of pascal function. Got ac. I am using dayofweek to get the weekday for the first of the month in the question. I am getting WA7. I think my formatting is OK but I am getting wrong answers for some inputs. The two supplied examples are OK, and 20 10 2050 mon 3 10 17 24 31 tue 4 11 18 25 wed 5 12 19 26 thu 6 13 [20] 27 fri 7 14 21 28 sat 1 8 15 22 29 sun 2 9 16 23 30 and 25 11 1885 mon 2 9 16 23 30 tue 3 10 17 24 wed 4 11 18 [25] thu 5 12 19 26 fri 6 13 20 27 sat 7 14 21 28 sun 1 8 15 22 29 but not 4 7 1890 mon [ 4] 11 18 25 tue 5 12 19 26 wed 6 13 20 27 thu 7 14 21 28 fri 1 8 15 22 29 sat 2 9 16 23 30 sun 3 10 17 24 31 or 1 1 1600 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 from what I have seen in the forum. Any ideas please? Thanks Edited by author 05.12.2012 22:33 | if wa9 | taobingxue | 1201. Какой сегодня день? | 2 сен 2011 04:29 | 2 | if wa9 taobingxue 24 окт 2009 19:56 test: 31 12 2400 be careful of the ']' You is good man! Thank you! | WHY WA#16 | Nick Loginov (USU) | 1201. Какой сегодня день? | 27 фев 2011 17:16 | 2 | WHY WA#16 Nick Loginov (USU) 26 мар 2010 08:44 Try to check this: 25 11 1885. The right answer is: mon........2....9...16...23...30 tue........3...10...17...24 wed........4...11...18..[25] thu........5...12...19...26 fri........6...13...20...27 sat........7...14...21...28 sun...1....8...15...22...29 Edited by author 27.02.2011 17:19 | WA5? | Timur Sitdikov (MSU TB) | 1201. Какой сегодня день? | 24 янв 2011 17:53 | 2 | WA5? Timur Sitdikov (MSU TB) 24 янв 2011 16:13 What is test 5? I can't find my mistake. Edited by author 24.01.2011 16:15 Edited by author 24.01.2011 16:15 Re: WA5? Timur Sitdikov (MSU TB) 24 янв 2011 17:53 My code: #include <stdio.h> void printdw(int* f1, int *f3, int d, int dd, int lim) { int f2=0; if (d==1 || *f1==1) { if (dd==d) {printf(" [%2d]", d); f2=1;} else {printf(" %2d", d);} *f1=1; } else { if (dd==d) {printf(" [%2d]", d); f2=1; *f1=1;} else {printf(" %2d", d);} } for(d+=7; d<=lim; d+=7) { if (f2==1) {printf(" %2d", d); f2=0;} else { if(d==dd) {printf(" [%2d]", d); f2=1;} else printf(" %2d", d); } } if (d==lim+7) *f3=1; if(d<lim+7 && *f3) { if (!f2) printf(" "); else printf(" ");} printf("\n"); } int main() { int dd, mm, yy, dw, lim, f1, f2, f3, d; scanf("%d %d %d", &dd, &mm, &yy); dw=(6+yy-1600+((yy-1)/4-399)-((yy-1)/100-15)+((yy-1)/400-3))%7; if (mm==5) dw++; if (mm==8) dw+=2; if (mm==2 || mm==3 || mm==11) dw+=3; if (mm==6) dw+=4; if (mm==9 || mm==12) dw+=5; if (mm==4 || mm==7) dw+=6; if (mm>2) { if (!(yy%4)) dw++; if (!(yy%100)) dw--; if (!(yy%400)) dw++;} dw%=7; if (mm==1 || mm==3 || mm==5 || mm==7 || mm==8 || mm==10 || mm==12) lim=31; else { if (mm!=2) lim=30; else {if (yy%4 ||(!(yy%100) && yy%400)) lim=28; else lim=29;} } f1=0; f3=0; printf("mon"); d=(8-dw)%7+1; printdw(&f1, &f3, d, dd, lim); printf("tue"); d=(d+7)%7+1; printdw(&f1, &f3, d, dd, lim); printf("wed"); d=(d+7)%7+1; printdw(&f1, &f3, d, dd, lim); printf("thu"); d=(d+7)%7+1; printdw(&f1, &f3, d, dd, lim); printf("fri"); d=(d+7)%7+1; printdw(&f1, &f3, d, dd, lim); printf("sat"); d=(d+7)%7+1; printdw(&f1, &f3, d, dd, lim); printf("sun"); d=(d+7)%7+1; printdw(&f1, &f3, d, dd, lim); } Please! help to find mistake! Edited by author 24.01.2011 17:54 | [WA #1] why my code got WA #1 | Luke Fang | 1201. Какой сегодня день? | 17 июл 2010 08:03 | 1 | According to the discussion board. I reference one code on here and change some thing. But why still got the wrong answer. I use the sample test to test. The answer is right. But when I upload to judgement. Alway got the WA #1. Someone can tell me why. Thank you. Below is my code. #include<stdio.h> #include<stdlib.h> int is_leap_year(int y){ return ( ( y%4==0 ) && (y%100!=0||y%400==0) ); } int days_per_year(int y){ if(is_leap_year(y)) return 366; else return 365; } int days_per_month(int m,int y){ const int days[12]={31,28,31,30,31,30,31,31,30,31,30,31}; if(m!=2) return days[m-1]; else if(is_leap_year(y)) return 29; else return 28; } int get_day_of_week(int m,int d,int y){ int day=4; /* Key point */ int i; for(i=1600;i<y;i++) day+=days_per_year(i); for(i=1;i<m;i++) day+=days_per_month(i,y); day+=d;
return day%7; } void print_calendar(int m,int d,int y) { const char* day_name[7]={"mon","tue","wed","thu","fri","sat","sun"}; int days=days_per_month(m,y); int day_begin=1-get_day_of_week(m,1,y); int more_print = (day_begin + days)%7;
int i,j,flag;
flag = 0; for(i=0;i<7;i++){ printf("%s",day_name[i]); for(j=day_begin+i ; j <= days + more_print ; j+=7 )
if( j<1 || j>days ) printf("....");
else if(j==d){ flag = 1; if(j<10) printf("..[%d]",j); else printf("..[%2d]",j); } else{ if(j<day_begin+7){ if(flag){ printf("..%d",j); flag = 0 ; } else{ printf("...%d",j); } } else if(j >= day_begin+7 && j<10){ if(flag){ printf("...%d",j); flag = 0 ; } else{ printf("....%d",j); } } else if(j>=10 && j<= days){ if(flag){ printf("..%2d",j); flag = 0 ; } else{ printf("...%2d",j); } } else{ printf("...."); } }/* if( j<1 || j>days ) */ printf("\n"); }/* for(i=0;i<7;i++) */ } int main() { int d,m,y; scanf("%d %d %d",&d,&m,&y); if( y < 1600 || y > 2400) exit(0); if( m < 1 || m > 12 ) exit(0); if( d < 1 || d > 31 ) exit(0);
print_calendar(m,d,y);
exit (0); } | AC (tests) | kxurshid | 1201. Какой сегодня день? | 1 окт 2009 06:07 | 1 | Some tests: 20 10 2050 mon........3...10...17...24...31 tue........4...11...18...25..... wed........5...12...19...26..... thu........6...13..[20]..27..... fri........7...14...21...28..... sat...1....8...15...22...29..... sun...2....9...16...23...30..... ////////////////////////////// 4 7 1890 mon........7...14...21...28 tue...1....8...15...22...29 wed...2....9...16...23...30 thu...3...10...17...24...31 fri.[.4]..11...18...25..... sat...5...12...19...26..... sun...6...13...20...27..... ///////////////////////////// '.' it's ' ' Good luck! Edited by author 01.10.2009 06:11 | AC | kxurshid | 1201. Какой сегодня день? | 1 окт 2009 06:06 | 1 | AC kxurshid 1 окт 2009 06:06 Some tests: 20 10 2050 mon 3 10 17 24 31 tue 4 11 18 25 wed 5 12 19 26 thu 6 13 [20] 27 fri 7 14 21 28 sat 1 8 15 22 29 sun 2 9 16 23 30 ////////////////////////////// 4 7 1890 mon 7 14 21 28 tue 1 8 15 22 29 wed 2 9 16 23 30 thu 3 10 17 24 31 fri [ 4] 11 18 25 sat 5 12 19 26 sun 6 13 20 27 Good luck! | Some help to ... | Oleg Strekalovsky [Vologda SPU] | 1201. Какой сегодня день? | 14 май 2009 20:02 | 1 | I solved this problem using: Calendar calendar = new GregorianCalendar(year,month-1,1) It helped me to get position of the first day of month and day's count at month. Pay attention to: 1)Day's count in month. 2)Use trim() to remove ending spaces. | WA#6 ?? I can't understand !! | FireHeart | 1201. Какой сегодня день? | 27 апр 2009 01:43 | 2 | Here is my code : {$M 16777216} Program P1201_Which_day_is_it; {$APPTYPE CONSOLE} Var Days:array [1600..2400] of byte; fday,day,sum,month:byte; year:word; i,j,k,h,d,code:integer; s,t:string; Calendar:array[1..7] of string; {-----------------------------------------------------------} Procedure Init; Begin Days[1600]:=2; i:=1601; While i<=year do Begin days[i]:=days[i-1]; if (i-1) mod 4 =0 then inc(days[i]); if i-1=1918 then inc(days[i]); inc(days[i]); if days[i]>7 then days[i]:=days[i] mod 7; inc(i); end; End; {-----------------------------------------------------------} Begin {$IFNDEF ONLINE_JUDGE} Assign(input,'Input.txt'); Reset(input); Assign(output,'Output.txt'); Rewrite(output); {$ENDIF} Readln(input,day,month,year); init; fday:=days[year]; For i:=1 to month-1 do Begin if (i=1)or(i=3)or(i=5)or(i=7)or(i=8)or(i=10) then inc(fday,3); if (i=2) then if year mod 4 = 0 then inc(fday,1); if (i=4)or(i=6)or(i=9)or(i=11)or(i=12) then inc(fday,2); End; if (month=1)or(month=3)or(month=5)or(month=7)or(month=8)or(month=10) then sum:=31; if (month=2) then if (year mod 4=0) then sum:=29 else sum:=28; if (month=4)or(month=6)or(month=11)or(month=12) then sum:=30; Calendar[7]:='sun'; Calendar[1]:='mon'; Calendar[2]:='tue'; Calendar[3]:='wed'; Calendar[4]:='thu'; Calendar[5]:='fri'; Calendar[6]:='sat'; if fday>7 then fday:=fday mod 7; for i:=fday-1 downto 1 do Calendar[i]:=Calendar[i]+' '; k:=fday; for i:=1 to sum do begin if i=day then s:=']' else s:=' '; str(i,t); if length(t)=1 then t:=' '+t; s:=t+s; if i=day then s:='['+s; while length(s)<5 do s:=' '+s; Calendar[k]:=Calendar[k]+s; if k=7 then k:=1 else inc(k); end; For i:=1 to 7 do Begin While Calendar[i][length(calendar[i])]=' ' do delete(Calendar[i],Length(calendar[i]),1); writeln(output,Calendar[i]); End; {$IFNDEF ONLINE_JUDGE} Close(input); Close(output); {$ENDIF} End. My code have WA#6, but I think it alright !! No 1918 or 1752 calendar corrections must be taken into account. Do just what is asked in the condition. | Can anyone explain me which day of week was 1.1.1600??? | Varduhy | 1201. Какой сегодня день? | 11 фев 2009 13:27 | 3 | Was it Tuesday or Saturday??? Edited by author 23.10.2008 17:36 Well, there's a simple way to find that out, isn't there? Pseudocode here: begin For(i = mon, i<=sun; ++i) { Solve problem assuming 1 Jan 1600 was i; if(YourOutput==SampleOutput) break; } if(i>sun) you have solved the problem wrongly whatsoever; else it's very LIKELY that 1 JAN 1600 was i; end. But in order to save time, you can just believe me that 1 Jan 1600 was Saturday. At least assuming that my AC program works correctly:) All the best. A. |
|
|