git reimport
This commit is contained in:
44
archive/2017.04/2017.04.16 - unsorted/TaskA.java
Normal file
44
archive/2017.04/2017.04.16 - unsorted/TaskA.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class TaskA extends SimpleSavingChelperSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
int n = in.nextInt();
|
||||
int m = in.nextInt();
|
||||
|
||||
int[][] a = new int[n][m];
|
||||
|
||||
int c = 1;
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
for (int j = 0; j < 100; j++) {
|
||||
int x = i - j;
|
||||
int y = j;
|
||||
|
||||
if (x < 0 || y < 0 || x >= n || y >= m) {
|
||||
continue;
|
||||
}
|
||||
|
||||
a[x][y] = c;
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (int j = 0; j < m; j++) {
|
||||
out.print(a[n - 1 - i][m - 1 - j] + " ");
|
||||
}
|
||||
out.println();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user