![:(](./images/smilies/icon_frown.gif)
631 - Microzoft Calendar
Moderator: Board moderators
631 - Microzoft Calendar
I can't solve this problem. As I see, it's not so hard, but all my attempts to get AC failed
. Could anyone tell me, what's wrong with the problem?
![:(](./images/smilies/icon_frown.gif)
-
- Experienced poster
- Posts: 167
- Joined: Fri Oct 19, 2001 2:00 am
- Location: Saint Petersburg, Russia
631 Microzoft calendar - need some inputs/outputs!
I am trying to solve this problem, but I can't get ACC.
I hate this kind of problems, but would really like to solve this one.
(personaly, this is one of the most ugly problems I have ever seen)
Please, post some inputs and clarifications ( if you can think of any ) because I am doing something wrong...
Thank You!
I hate this kind of problems, but would really like to solve this one.
(personaly, this is one of the most ugly problems I have ever seen)
Please, post some inputs and clarifications ( if you can think of any ) because I am doing something wrong...
Thank You!
A sta da radim
Getting many WA...
Could someone verify my i/o test ?
INPUT
OUTPUT
Thanks in advance.
----
Rio
Could someone verify my i/o test ?
INPUT
Code: Select all
1998-06-19
1997-06-26
1997-06-25
1997-06-24
1600-01-01
1754-12-31
2476-12-04
4444-04-12
END
Code: Select all
Bates-Money-Sixth-6-1bd
Gill-Sun-First-2-1bd
Gill-Sun-First-1-1bd
Feast 5-2bd
Bates-Sun-Fourth-3-399bd
Bates-Sun-Second-4-244bd
Gill-Money-Fourth-2-479
Bates-Mountains-First-5-2446
----
Rio
-
- Guru
- Posts: 1080
- Joined: Thu Dec 19, 2002 7:37 pm
Sorry, my solution is in Pascal and I currently have no compiler for it.
One, quite simple, way to test your program is to write two functions old_next(year,month,day) and new_next(year,period,month,week,day) that can be implemented as a series of nested if-else statements. You could internally represent the 'feast' days as period 3, or something like that.
Now have a program that writes old dates to a file called 'test.in' and new dates to a file called 'test.out'. Start the program off at old date (1600,1,1) and new date (-399,2,1,2,4), writing to the files and calling old_next() and new_next(), until you reach new date (5000,1,1).
Run your solution with 'test.in' as input and compare its output with 'test.out'.
EDIT: stubbscroll is right, 1600-01-01 is Bates-Sun-Second-4-399bd. I changed my posting accordingly.
One, quite simple, way to test your program is to write two functions old_next(year,month,day) and new_next(year,period,month,week,day) that can be implemented as a series of nested if-else statements. You could internally represent the 'feast' days as period 3, or something like that.
Now have a program that writes old dates to a file called 'test.in' and new dates to a file called 'test.out'. Start the program off at old date (1600,1,1) and new date (-399,2,1,2,4), writing to the files and calling old_next() and new_next(), until you reach new date (5000,1,1).
Run your solution with 'test.in' as input and compare its output with 'test.out'.
EDIT: stubbscroll is right, 1600-01-01 is Bates-Sun-Second-4-399bd. I changed my posting accordingly.
Last edited by little joey on Wed May 30, 2007 2:29 pm, edited 2 times in total.
The biggest problem with most problems is not how to solve the problem, but how to not solve what is not the problem.
-
- Experienced poster
- Posts: 151
- Joined: Tue Nov 16, 2004 7:23 pm
- Location: Norway
- Contact:
Rio, I get a different output for line 5 with my AC program. Here's my output for your tests:
Code: Select all
Bates-Money-Sixth-6-1bd
Gill-Sun-First-2-1bd
Gill-Sun-First-1-1bd
Feast 5-2bd
Bates-Sun-Second-4-399bd
Bates-Sun-Second-4-244bd
Gill-Money-Fourth-2-479
Bates-Mountains-First-5-2446
-
- Experienced poster
- Posts: 139
- Joined: Wed May 18, 2011 3:04 pm
Re: 631 - Microzoft Calendar
Test data generator:
Code: Select all
#include <iostream>
using namespace std;
bool isLeapYear(int yyyy)
{
return ((yyyy % 4 == 0 && yyyy % 100 != 0) || yyyy % 400 == 0);
}
int main(int argc, char *argv[])
{
for (int i = 1600; i <= 5000; i += 100)
{
for (int j = 1; j <= 12; j++)
{
if (j == 2)
{
for (int k = 1; k <= 28; k++)
{
cout << i << "-02-";
if (k < 10) cout << '0';
cout << k << '\n';
}
if (isLeapYear(i)) cout << i << "-02-29\n";
}
else
{
for (int k = 1; k <= 30; k++)
{
cout << i << '-';
if (j < 10) cout << '0';
cout << j << '-';
if (k < 10) cout << '0';
cout << k << '\n';
}
if (j == 1 || j == 3 || j == 5 || j == 7 || j == 8 || j == 10 || j == 12)
{
cout << i << '-';
if (j < 10) cout << '0';
cout << j << "-31\n";
}
}
}
}
cout << "END\n";
return 0;
}
metaphysis: http://uhunt.onlinejudge.org/id/95895
My solutions for UVa problems: https://github.com/metaphysis/Code.
My solutions for UVa problems: https://github.com/metaphysis/Code.