정올-도형만들기1-1303 숫자사각형1

Titanium·2025년 1월 10일


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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		StringBuilder sb = new StringBuilder();
		int col = Integer.parseInt(st.nextToken());
		int row = Integer.parseInt(st.nextToken());
		int start = 1;

		for (int i = 0; i < col; i++) {
			for (int j = 0; j < row; j++) {
				sb.append(start + " ");
				start++;
			}
			sb.append("\n");
		}
		System.out.println(sb);
	}
}
profile
핵심먼저

0개의 댓글