Skip to content

Commit

Permalink
[D3] Title: [S/W 문제해결 기본] 5일차 - Magnetic, Time: 149 ms, Memory: 34,49…
Browse files Browse the repository at this point in the history
…6 KB -BaekjoonHub
  • Loading branch information
sey2 committed Nov 17, 2023
1 parent 107da9e commit 359c2f3
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# [D3] [S/W 문제해결 기본] 5일차 - Magnetic - 1220

[문제 링크](https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14hwZqABsCFAYD)

### 성능 요약

메모리: 34,496 KB, 시간: 149 ms, 코드길이: 1,109 Bytes

### 제출 일자

2023-11-18 01:20



> 출처: SW Expert Academy, https://swexpertacademy.com/main/code/problem/problemList.do
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Solution {

public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = 10;

int cnt = 1;
while(T-->0) {
int n = Integer.parseInt(br.readLine());

int ans = 0;
char arr[][] = new char[100][100];

for(int i=0; i<100; i++) {
String in[] = br.readLine().split(" ");
for(int j=0; j<100; j++) {
arr[i][j] = in[j].charAt(0);
}
}

for(int i=0; i<100; i++) {
boolean check = false;

for(int j=0; j<100; j++) {
if(arr[j][i] == '1') check = true;
if(arr[j][i] == '2' && check) {
ans ++;
check = false;
}
}
}

System.out.println("#" + cnt++ + " " + ans);
}
}

}

0 comments on commit 359c2f3

Please sign in to comment.