![[java] 백준 10250번 ACM 호텔](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcaGBk0%2Fbtq9yL1ZkQS%2FhYWespKIkWeSowOEitULT1%2Fimg.jpg)
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for(int i=0; i
![[java] 백준 2869번 달팽이는 올라가고 싶다.](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbhcCIU%2Fbtq9C9NJF3q%2FcZLF5c4qGs453k6lNDSgL1%2Fimg.jpg)
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); // 낮에 올라갈 수 있는 거리 int b = sc.nextInt(); // 밤에 내려가는 거리 int v = sc.nextInt(); // 나무막대의 높이 int tot = a-b; // 하루에 이동하는 거리 // 정상에 올라간 후에는 미끄러지지 않는다고 했기 때문에 // v에서 a 거리를 먼저 빼주고 계산 v = v - a; // 위에서 마지막 하루 이동하는 거리를 빼고 계산했기 때문에 결과에 하루를 더해줌. // 딱 나누어 떨어질 경우에는 +1 if(v ..
![[java] 백준 1193번 분수 찾기](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FEefeY%2Fbtq9reoMhwa%2FcweoEWblsQkBaJddkj5HK1%2Fimg.jpg)
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x= sc.nextInt(); int tmp=0, cross_line=0; // 대각선 줄로 보면 줄하나가 생길때마다 원소가 1개씩 늘어나는 걸 볼 수 있음 // 대각선 줄 구하는 방법 for(int i=1; i= x) { cross_line=i; break; } } // 대각선 줄이 홀수/짝수 개수일 때 해당하는 원소 값 구하는 방법 if(cross_line % 2 == 1) System.out.println((1+tmp-x) + "/" + (cross_line-(tmp-x))); else..
![[java] 백준 2292번 벌집](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FUvMIv%2Fbtq9gATkVLy%2F7hLRZw4bszlaXWwc6gImTk%2Fimg.jpg)
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int count = 1; // 칸수 세는 count int range = 1; // 범위는 1부터 시작 int increase = 1; // 6의 배수만큼 범위를 올리기위해서 사용 // // 범위 // // 1 -> 1 1 1 // // 2~7 -> 2 1 6 // // 8~19 -> 3 6 12 // // 20~37 -> 4 12 18 // // 38~61 -> 5 18 24 while (range < n) { increase = (count++) * 6;..