Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions 이지수/SWEA/D2/1961. 숫자 배열 회전
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import java.util.Scanner;

class Solution
{
public static void main(String args[]) throws Exception
{
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();

for(int test_case = 1; test_case <= T; test_case++)
{
int N = sc.nextInt();
int[][] arr = new int[N][N];
char[][] result90 = new char[N][N];
char[][] result180 = new char[N][N];
char[][] result270 = new char[N][N];
for(int i = 0; i < N; i++) {
for(int j = 0; j < N; j++) {
arr[i][j] = sc.nextInt();
result90[j][N - i - 1] = (char)(arr[i][j] + '0');
result180[N - i - 1][N - j - 1] = (char)(arr[i][j] + '0');
result270[N - j - 1][i] = (char)(arr[i][j] + '0');
}
}

System.out.println("#" + test_case);
for(int i = 0; i < N; i++) {
System.out.println(String.valueOf(result90[i]) + " " + String.valueOf(result180[i]) + " " + String.valueOf(result270[i]));
}
}
}
}
56 changes: 56 additions & 0 deletions 이지수/SWEA/D2/1974. 스도쿠 검증
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import java.util.Scanner;

class Solution {
public static void main(String args[]) throws Exception {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();

for(int test_case = 1; test_case <= T; test_case++) {
int[][] arr = new int[9][9];
for(int i = 0; i < 9; i++) {
for(int j = 0; j < 9; j++) {
arr[i][j] = sc.nextInt();
}
}

int rowIdx = 0;
int colIdx = 0;
boolean flag = false;
for(int i = 0; i < 9; i++){
int[] row = new int[9];
int[] col = new int[9];
int[] box = new int[9];

for(int j = 0; j < 9; j++) {
if(row[arr[i][j] - 1] != 0 || col[arr[j][i] - 1] != 0 || box[arr[rowIdx][colIdx] - 1] != 0) {
flag = true;
break;
}

row[arr[i][j] - 1]++;
col[arr[j][i] - 1]++;
box[arr[rowIdx][colIdx] - 1]++;
if((j + 1) % 3 == 0) {
colIdx -= 2;
rowIdx++;
}
else
colIdx++;
}
if(flag) {
System.out.println("#" + test_case + " " + 0);
break;
}
if((i + 1) % 3 == 0) {
rowIdx -= 9;
colIdx += 3;
}
}

if(!flag)
System.out.println("#" + test_case + " " + 1);
}

sc.close();
}
}