3494 WA!

Do you want to discuss about these problems? Go now!
Users are shared (no need to re-register).

Moderator: Board moderators

Post Reply
Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

3494 WA!

Post by Obaida » Thu Jan 15, 2009 7:50 am

I edited my code severel times but got wA!!! Seems got WA thousand times :o :o :o
Some one pelase help me.

Code: Select all

#include<stdio.h>
#include<math.h>
int main()
{
	int n,i,d,m,y,a,b,dif,dif1;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%d/%d/%d %d/%d",&m,&d,&y,&a,&b);
		if(m-a==11||m-a==-11)
		{
			if(m>a)
			{
				dif = 31-d;
				dif += b;
				y++;
			}
			else 
			{
				dif = 31-b;
				dif += d;
				dif = -dif;
				y--;
			}
		}
		else if(m>a)
		{
			if(a==1||a==3||a==5||a==7||a==8||a==10||a==12) dif = 31 - b;
			else if(a==4||a==6||a==9||a==11) dif = 30 - b;
			else
			{
				if((y-2000)%2==0&&((y-2000)/2)%2==0)
					dif = 29-b;
				else
					dif = 28-b;
			}
			dif += d;
		}
		else if(m<a)
		{
			dif = b;
			if(m==1||m==3||m==5||m==7||m==8||m==10||m==12) dif += 31-d;
			else if(m==4||m==6||m==9||m==11)dif += 30-d;
			else
			{
				if((y-2000)%2==0&&((y-2000)/2)%2==0)
					dif+=29-d;
				else
					dif+=28-d;
			}
			dif = -dif;
		}
		else dif = b - d;
		dif1 = m-a;
		if(dif1<0)dif1=-dif1;
		printf("%d ",i);
		if((m<a||m>a)&&dif1!=11&&dif1!=1)printf("OUT OF RANGE\n");
		else if(dif>7||dif<-7)printf("OUT OF RANGE\n");
		else if(dif==0)printf("SAME DAY\n");
		else if(dif<0)printf("%d/%d/%d IS %d DAYS PRIOR\n",a,b,y,-dif);
		else printf("%d/%d/%d IS %d DAYS AFTER\n",a,b,y,dif);
	}
	return 0;
}
try_try_try_try_&&&_try@try.com
This may be the address of success.

Post Reply

Return to “ACM ICPC Archive Board”