1. Member Join Date
Oct 2010
Posts
1
Rep Power
0

## Can translate?

Hey guys, I know this is ridiculous. But I'm really dumb in JAVA Programming.
I wrote these codes in C, but I need to submit it in JAVA codes. Can someone help me out on this? Can someone translate it for me?

Java Code:
```#include<stdio.h>
#define SZ 1001
#define MIN(a,b) ((a)<(b)?(a):(b))
int a[SZ][SZ];
int n,k,i,j,x,s,p,q,size;
int main(){
scanf("%d%d",&n,&k);
for(i=0;i<n;i++)
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
for(p=1,s=1;(1<<p)<=k;p++,s*=2)
for(i=0;i+s<n;i++)
for(j=0;j+s<n;j++)
a[i][j][p] = MIN( MIN(a[i][j][p-1],a[i+s][j+s][p-1]) , MIN(a[i+s][j][p-1],a[i][j+s][p-1]) );
s = 0;
while(2*(1<<s)<=k) s++;
x = k - (1<<s);
for(i=0;i+k<=n;i++){
for(j=0;j+k<=n;j++){
printf("%d",MIN( MIN(a[i][j][s],a[i+x][j+x][s]) , MIN(a[i+x][j][s],a[i][j+x][s]) ));
if(j+k!=n) printf(" ");
}
if(i+k!=n) printf("\n");
}
return 0;
}```  Reply With Quote

2. Senior Member Join Date
May 2010
Posts
436
Rep Power
11

## This ain't a "here's my problem, now code this for me site", so for gosh sake, put in at least some effort. You can find the tutorials here: The Really Big Index

These should get you started in learning how to code Java. Then please feel free to come on back when you show that you're willing to put in at least as much effort as you ask of us.  Reply With Quote

3. ## Do you know any Java at all? And what is this for, school?  Reply With Quote

4. Moderator   Join Date
Apr 2009
Posts
13,541
Rep Power
27

## You wrote that in C?
Without any indentation?

...

ETA: What does it do?  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•