## 10849 - Move the bishop

Moderator: Board moderators

Prianka
New poster
Posts: 6
Joined: Fri Jul 04, 2008 4:06 pm

### Re: 10849 - Move the bishop

Many many thanks to Maruf.
But it is just a stupid joke nothing else.
If there is no newline so why the judges gave this condition-------
he input begins with a single integer, C, indicating the number of test cases following, each of them as described below. This line is followed by a blank line, and there is also a blank line between two consecutive test cases.
Any way thanks again to help me a lot.
Thanks.
Nothing is impossible............
abid_iut
Learning poster
Posts: 82
Joined: Wed Jul 16, 2008 7:34 am

### Re: 10849 - Move the bishop

what is the problem in this code
I think it goes with the algorithm given in previous threads.
here is the code:

Code: Select all

``````#include<stdio.h>

int main()
{
long x1,y1,x2,y2,n,num,N;
scanf("%ld",&n);
for(int it=0;it<n;it++){
scanf("%ld",&num);
scanf("%ld",&N);
for(int i=0;i<num;i++){
scanf("%ld %ld %ld %ld",&x1,&y1,&x2,&y2);
if(x1 == x2 == y1 == y2){printf("0\n");continue;}
else if(x1==y1 && x2==y2){printf("1\n");continue;}
if((((x1+y1)%2==0) && ((x2+y2)%2==0)) || (((x1+y1)%2==1) && ((x2+y2)%2==1))){
if(x1+y1 == x2+y2)printf("1\n");
else printf("2\n");
}
else printf("no move\n");
}
}
return 0;
}

``````
pls help
i love to wait... wait for better... and better will come...
http://akanoi.webs.com/
helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

### Re: 10849 - Move the bishop

Try this case..

Code: Select all

``````1

1
4
1 2 2 3``````
My output is

Code: Select all

``1``
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

### Re: 10849 - Move the bishop

Here's some input / output that I found useful during testing / debugging.

Input:

Code: Select all

``````2

3
100000000
3 6 3 6
100000000 100000000 1 1
56724 9862 8746 190234

20
8
5 5 3 8
5 5 8 3
5 5 7 7
5 5 4 4
6 6 2 7
6 6 7 2
6 6 1 1
6 6 4 4
2 7 2 2
2 7 3 3
2 7 8 1
2 7 1 8
5 8 2 2
5 8 7 7
5 8 3 2
5 8 8 1
6 1 1 6
5 5 8 8
3 4 1 2
7 6 8 4``````
AC Output:

Code: Select all

``````0
1
2
no move
no move
1
1
no move
no move
1
1
no move
no move
1
1
no move
no move
2
2
1
1
1
no move``````
Check input and AC output for over 7,500 problems on uDebug!

axelblaze
New poster
Posts: 34
Joined: Mon Jun 23, 2014 7:45 pm

### Re: 10849 - Move the bishop

I have no idea why I'm getting WA...

Code: Select all

``removed after ac``
Last edited by axelblaze on Fri Aug 08, 2014 2:50 am, edited 1 time in total.
waheed
New poster
Posts: 6
Joined: Mon Jul 07, 2014 5:55 pm

### 10849 - Move the bishop

i get WA with this code help plz

import java.io.IOException;
import java.util.StringTokenizer;

public class Main {
public static void main (String [] args) throws NumberFormatException, IOException{
int s ;
int t ;
int u ;
int v ;
for(int i = 0;i<n;i++){
for(int j = 0;j<x;j++){
int a = Integer.parseInt(f.nextToken());
int b = Integer.parseInt(f.nextToken());
int c = Integer.parseInt(f.nextToken());
int d = Integer.parseInt(f.nextToken());
s = a+b;
t = c+d;
u = a-b;
v = c-d ;
if((s%2==0 && t%2!=0)||(s%2!=0 && t%2==0) )
System.out.println("no move");
else
if(s!=t && u!=v)
System.out.println(2);
else
System.out.println(1);

}

}

}

}
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

### Re: 10849 - Move the bishop

axelblaze wrote:I have no idea why I'm getting WA...
Try running the test case on the post above yours and do a diff of the output files. (Hint: You're printing extra newlines.)
Check input and AC output for over 7,500 problems on uDebug!

lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

### Re: 10849 - Move the bishop

Don't open new thread. Use search first by problem number (10849 for this problem)
http://acm.uva.es/board/search.php?keyw ... 45b4825c8d

For this problem there is existing thread
http://acm.uva.es/board/viewtopic.php?f ... 45b4825c8d
You can check your program for input/output tests posted here.

Also you must post for this problem in the Volume CVIII.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
waheed
New poster
Posts: 6
Joined: Mon Jul 07, 2014 5:55 pm

### Re: 10849 - Move the bishop

done
Last edited by waheed on Sun Jul 20, 2014 2:55 am, edited 1 time in total.
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

### Re: 10849 - Move the bishop

waheed wrote:i fed up with this problem ,i have no idea why i get WA HELP PLZZZZ

Also, try moving the "buffer.readLine();" inside the for loop like so

Code: Select all

``````public class Main {
public static void main(String[] args) throws NumberFormatException,
IOException {
System.in));
long s;
long t;
long u;
long v;
for (int i = 0; i < n; i++) {
// Moved readline inside for loop
...``````
Check input and AC output for over 7,500 problems on uDebug!

lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

### Re: 10849 - Move the bishop

Are you fed up with getting Accepted?
I got accepted by sending your java solution.
What is your problem? Check it once again.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
waheed
New poster
Posts: 6
Joined: Mon Jul 07, 2014 5:55 pm

### Re: 10849 - Move the bishop

ops i don't what happenend it is a miracle i run it thousand times and didn't work now it works any way thaaaaaaaaaaaaaaaaaaanks
lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

### Re: 10849 - Move the bishop

It will be good if you remove your code after getting accepted
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

### Re: 10849 - Move the bishop

lighted wrote:It will be good if you remove your code after getting accepted
You said it! A significant percentage of people post code when asking for help and then leave it on there once they've figured out the solution. The forum is full of nearly AC (or even AC) code like that. Requesting people to remove their code hardly every works. But perhaps it's worth trying.
Check input and AC output for over 7,500 problems on uDebug!