4

2022-08-28 [11회차] 알고리즘 스터디

1. 팔 - 실버1 08-28 일 출처 https://www.acmicpc.net/problem/1105 1105번: 팔 첫째 줄에 L과 R이 주어진다. L은 2,000,000,000보다 작거나 같은 자연수이고, R은 L보다 크거나 같고, 2,000,000,000보다 작거나 같은 자연수이다. www.acmicpc.net MySol) ======= 미해결 코드 ======== import java.util.Scanner; public class Test { static int findEight(String s){ int eightCnt = 0; for(char c : s.toCharArray()) { if (c == '8') { ++eightCnt; } } return eightCnt; } public s..

BFS 마법의 비료

/* 5 4 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 1 */ package first; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class MagiFertilizer0 { static int MAX_COUNT = 101; static int [][] AdjMatrix = new int[MAX_COUNT][MAX_COUNT]; static int [][] VisitMatrix = new int[MAX_COUNT][MAX_COUNT]; static int Width; static int Height; static int DIRECTION = 4; static int [..

Code up 4503 바이러스 (BFS)

Ex) import java.util.HashSet; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; import java.util.Set; public class BFSpractice0 { static int MAX_COUNT = 101; static int [][] AdjMatrix = new int [MAX_COUNT][MAX_COUNT]; static int[] VisitMatrix = new int[MAX_COUNT]; static int VertaxCount, EdgeCount; static Queue queue = new LinkedList(); static Set set = new HashSet()..

Java로 BFS 구현하기

Ex) package first; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class BFSpractice0 { static int MAX_COUNT = 101; static int [][] AdjMatrix = new int [MAX_COUNT][MAX_COUNT]; static int[] VisitMatrix = new int[MAX_COUNT]; static int VertaxCount, EdgeCount; static Queue queue = new LinkedList(); public static void main(String[] args) { int StartV = 1; Scanne..