## UVa 1727 ( Counting Weekend Days )

Moderator: Board moderators

ssavi
New poster
Posts: 28
Joined: Thu Nov 20, 2014 9:57 pm

### UVa 1727 ( Counting Weekend Days )

Hey . Is there any problem with JUDGE DATA SET / Solution of the Problem ... of the Problem ...

https://uva.onlinejudge.org/index.php?o ... oblem=4923 ( Counting Weekend Days )

I have submitted several Times But its getting WA all the time .
Here is my Code ...

Code: Select all

``````#include<bits/stdc++.h>
#define MOD 1000000007
#define LL long long

using namespace std;

int main()
{

string month, day;
int test;
scanf("%d", &test);
//freopen("inp.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
while(test--)
{
cin>>month>>day;
int md, ptr;
if(month=="JAN" || month=="MAR" || month=="MAY" || month=="JUL" || month=="AUG" || month=="OCT" || month=="DEC")
md = 31;
else if(month=="APR" || month=="JUN" || month=="SEP" || month=="NOV")
md = 30;
else if(month=="FEB") md = 28;
int cnt = 0, temp;
if(day=="SUN") ptr = 1;if(day=="MON") ptr = 2; if(day=="TUE") ptr = 3;
if(day=="WED") ptr = 4;if(day=="THU") ptr = 5; if(day=="FRI") ptr = 6;if(day=="SAT") ptr = 7;
//cout<<md+ptr-1<<endl;
for(int i=ptr; i<=md+ptr-1; i++)
{
temp = i%7;
if(temp==6 || temp==0) cnt++;
}
printf("%d\n", cnt);
}
return 0;
}
``````
What is the Problem LET me know please ... Some more users tried this easy problem but they also got WA ... Check this out please .
@brianfry ... Over to You .
Last edited by ssavi on Sat Dec 12, 2015 5:15 am, edited 1 time in total.
I know I am a Failure Guy .

ssavi
New poster
Posts: 28
Joined: Thu Nov 20, 2014 9:57 pm

### Re: UVa 1727 ( Counting Weekend Days )

I have tried All possible I/Os that could be in the Judge Data Set . And I have simulate those I/O manually . Got Correct Answer for those Cases for my Code . Here is the I/O s I have Tried . Have I missed anything ... Help me .

Code: Select all

``````84
JAN SAT
FEB SAT
MAR SAT
APR SAT
MAY SAT
JUN SAT
JUL SAT
AUG SAT
SEP SAT
OCT SAT
NOV SAT
DEC SAT
JAN SUN
FEB SUN
MAR SUN
APR SUN
MAY SUN
JUN SUN
JUL SUN
AUG SUN
SEP SUN
OCT SUN
NOV SUN
DEC SUN
JAN MON
FEB MON
MAR MON
APR MON
MAY MON
JUN MON
JUL MON
AUG MON
SEP MON
OCT MON
NOV MON
DEC MON
JAN TUE
FEB TUE
MAR TUE
APR TUE
MAY TUE
JUN TUE
JUL TUE
AUG TUE
SEP TUE
OCT TUE
NOV TUE
DEC TUE
JAN WED
FEB WED
MAR WED
APR WED
MAY WED
JUN WED
JUL WED
AUG WED
SEP WED
OCT WED
NOV WED
DEC WED
JAN THU
FEB THU
MAR THU
APR THU
MAY THU
JUN THU
JUL THU
AUG THU
SEP THU
OCT THU
NOV THU
DEC THU
JAN FRI
FEB FRI
MAR FRI
APR FRI
MAY FRI
JUN FRI
JUL FRI
AUG FRI
SEP FRI
OCT FRI
NOV FRI
DEC FRI
``````
And here is the outputs for this inputs :

Code: Select all

``````9
8
9
9
9
9
9
9
9
9
9
9
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
9
8
9
8
9
8
9
9
8
9
8
9
10
8
10
9
10
9
10
10
9
10
9
10
10
8
10
10
10
10
10
10
10
10
10
10
``````
I know I am a Failure Guy .