-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[D3] Title: [S/W 문제해결 기본] 5일차 - Magnetic, Time: 149 ms, Memory: 34,49…
…6 KB -BaekjoonHub
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
41 changes: 41 additions & 0 deletions
41
SWEA/D3/1220. [S/W 문제해결 기본] 5일차 - Magnetic/[S/W 문제해결 기본] 5일차 - Magnetic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
|
||
} |