All about problems in Volume 114. If there is a thread about your problem, please use it. If not, create one with its number in the subject.
Moderator: Board moderators
bleedingeyes
New poster
Posts: 9 Joined: Thu Aug 21, 2008 3:08 am
Location: IUT
Post
by bleedingeyes » Thu Sep 25, 2008 2:23 am
what wrong with my logic?
why WA?
please help me
Last edited by
bleedingeyes on Thu Sep 25, 2008 4:19 am, edited 1 time in total.
wanna be notorious....
helloneo
Guru
Posts: 516 Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea
Post
by helloneo » Thu Sep 25, 2008 2:34 am
Try this input
edit:
invalid test case removed
Last edited by
helloneo on Tue Oct 14, 2008 2:09 pm, edited 1 time in total.
bleedingeyes
New poster
Posts: 9 Joined: Thu Aug 21, 2008 3:08 am
Location: IUT
Post
by bleedingeyes » Thu Sep 25, 2008 4:19 am
thanx helloneo
i forgot the case where queen can mone straight. not diagonal
i got AC now
thank you very much
wanna be notorious....
kangroo
New poster
Posts: 13 Joined: Fri Sep 12, 2008 9:12 am
Post
by kangroo » Tue Oct 14, 2008 12:30 pm
hi everybody,
is the test case provided by "helloneo" 1 0 2 0 a valid one ??
in the problem desc its given tat 1 <= X1,Y1,X2,Y2 <= 8...
but here Y1 = 0 and Y2 = 0...
how is it posible ???
pls anyone help me to understand that test case...
helloneo
Guru
Posts: 516 Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea
Post
by helloneo » Tue Oct 14, 2008 2:05 pm
kangroo wrote: hi everybody,
is the test case provided by "helloneo" 1 0 2 0 a valid one ??
in the problem desc its given tat 1 <= X1,Y1,X2,Y2 <= 8...
but here Y1 = 0 and Y2 = 0...
how is it posible ???
pls anyone help me to understand that test case...
Oops.. Sorry..
Maybe there is no case like that..
kangroo
New poster
Posts: 13 Joined: Fri Sep 12, 2008 9:12 am
Post
by kangroo » Tue Oct 14, 2008 4:19 pm
can anyone provide me some test cases ?...i m getting WA
pls help me!!
thanks in advance..
sadia_atique
New poster
Posts: 25 Joined: Thu Nov 24, 2011 6:32 am
Post
by sadia_atique » Mon Nov 28, 2011 6:01 pm
I've no idea where I've gone wrong in the logic..getting WA in Queen;please,can anyone help me?
Code: Select all
#include<stdio.h>
int absolute(int x)
{
if(x<0) return x*(-1);
else return x;
}
int main()
{
int x1,y1,x2,y2,move;
while(1)
{
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
if((x1==0) && (y1==0) && (x2==0) && (y2==0)) break;
if((x1==x2) && (y1==y2)) move=0;
else if((x1==x2) && (y1=!y2)) move =1;
else if((x1!=x2) && (y1==y2)) move=1;
else if((x1!=x2) && (y1!=y2))
{
if(absolute(x1-x2)==absolute(y1-y2)) move=1;
else move=2;
}
printf("%d\n",move);
}
return 0;
}
sohel
Guru
Posts: 856 Joined: Thu Jan 30, 2003 5:50 am
Location: New York
Post
by sohel » Tue Nov 29, 2011 5:00 am
In this condition
else if((x1==x2) && (y1=! y2)) move =1;
shouldn't it be y1!= y2 ?
!= and =! aren't the same thing.
engnaruto
New poster
Posts: 2 Joined: Wed Nov 07, 2012 7:41 pm
Post
by engnaruto » Wed Nov 07, 2012 7:45 pm
i want to know what's wrong with my code
Code: Select all
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
while (input.hasNext()) {
int x1 = input.nextInt();
int y1 = input.nextInt();
int x2 = input.nextInt();
int y2 = input.nextInt();
if (x1 > 8 || x1 < 0 || x2 > 8 || x2 < 0 || y1 > 8 || y1 < 0
|| y2 > 8 || y2 < 0) {
System.exit(0);
} else if (x1 == 0 && x2 == 0 && y1 == 0 && y2 == 0) {
System.exit(0);
} else if ((Math.abs(x1 - x2) == Math.abs(y1 - y2))
|| ((x1 - x2) == 0) || ((y1 - y2) == 0)) {
System.out.println(1);
} else if ((x1 == x2) && (y1 == y2)) {
System.out.println(0);
} else {
System.out.println(2);
}
}
}
}
brianfry713
Guru
Posts: 5947 Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA
Post
by brianfry713 » Wed Nov 07, 2012 10:18 pm
It doesn't match the sample I/O.
Check input and AC output for thousands of problems on
uDebug !
brianfry713
Guru
Posts: 5947 Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA
Post
by brianfry713 » Tue Dec 03, 2013 3:10 am
That is AC code
Check input and AC output for thousands of problems on
uDebug !
uDebug
A great helper
Posts: 475 Joined: Tue Jul 24, 2012 4:23 pm
Post
by uDebug » Wed Mar 12, 2014 8:33 am
Here's some input / output that I found useful during testing / debugging.
Input:
Code: Select all
1 8 8 8
1 5 6 1
3 7 2 8
5 5 8 8
8 3 8 3
8 3 6 1
1 3 3 1
7 8 7 1
0 0 0 0
AC Output: