帮我把这个c程序转成java,谢谢!
来源:百度知道 编辑:UC知道 时间:2024/06/21 17:33:01
#include <stdio.h>
#include <stdlib.h>
#define Black 1
#define White 2
int table[2000][2000];
#define S_Table table[x][y] =
#define G_Table table[x][y]
int get_colour(int x, int y){
if(x < 0 || y <0)
printf("Non");
if(G_Table != 0)
return G_Table;
if(x == 0){
if(x != y)
S_Table Black;
return Black;
}
if(y == 0){
if(x != y)
S_Table White;
return White;
}
if(y > x)
return get_colour(x,x);
if(get_colour((x-y),(y -1)) == get_colour(x,(y-1))){
if(x != y)
S_Table White;
return White;
}
if(x !=y)
S_Table Black;
return Black;
}
int main(int argc, char **argv){
int x;
int y;
int r;
#include <stdlib.h>
#define Black 1
#define White 2
int table[2000][2000];
#define S_Table table[x][y] =
#define G_Table table[x][y]
int get_colour(int x, int y){
if(x < 0 || y <0)
printf("Non");
if(G_Table != 0)
return G_Table;
if(x == 0){
if(x != y)
S_Table Black;
return Black;
}
if(y == 0){
if(x != y)
S_Table White;
return White;
}
if(y > x)
return get_colour(x,x);
if(get_colour((x-y),(y -1)) == get_colour(x,(y-1))){
if(x != y)
S_Table White;
return White;
}
if(x !=y)
S_Table Black;
return Black;
}
int main(int argc, char **argv){
int x;
int y;
int r;
public class Conv{
final const int Black = 1;
final const int White = 2;
int table[2000][2000];
int get_colour(int x, int y){
if(x < 0 || y <0)
System.out.printf("Non");
if(table[x][y]!= 0)
return table[x][y];
if(x == 0){
if(x != y)
table[x][y] = Black;
return Black;
}
if(y == 0){
if(x != y)
table[x][y] = White;
return White;
}
if(y > x)
return get_colour(x,x);
if(get_colour((x-y),(y -1)) == get_colour(x,(y-1))){
if(x != y)
table[x][y] = White;
return White;
}
if(x !=y)
table[x][y] = Black;
return Black;
}
public static void main(String args[])
{
int x;
int y;
int r;
int i;
for(