Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
Страница 4 |
Pay attention! | andreyDagger | 1201. Какой сегодня день? | 4 июн 2022 16:45 | 2 |
January 1st 1600 is sunday, not monday! It's saturday, not sunday! |
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. |
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... |
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 |
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 |
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 |
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 |
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 #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); } |
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 |
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! |
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. |
Страница 3 |
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. |
ExuSe me!! but i'm so happy!! | Hedin | 1201. Какой сегодня день? | 7 апр 2008 12:46 | 3 |
AC just in 1 hour... What a weird problem? Just a brain#@$^ing... Edited by author 07.04.2008 12:46 Hm.. IMHO it is just coding problem) Without any brain...) But anyway, congradulations!) |
getting WA 1 any reasons?? | Anupam Ghosh,Bengal Engg and Science University,Shibpur,India | 1201. Какой сегодня день? | 15 дек 2007 16:45 | 1 |
my program is successful in all years from 1755- 3999. should the correction of 1752 has to be taken into account? but then that cannot be the first test. |
Can I use #Include <iomanip> ? | <-UnderFelixAbove-> | 1201. Какой сегодня день? | 7 фев 2009 13:21 | 2 |
I got CE. Please answer the question. In case you want to format the ouput, <iostream> will be just fine |