-
[java]백준 초콜릿 자르기 2163번알고리즘 문제풀이/백준(자바) 2023. 5. 4. 20:45
코드
import java.util.Scanner; public class BOJ_2163 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n =in.nextInt(); int m =in.nextInt(); int s=0; int a=n*m; while (true) { if (a==1) {//총조각 1이면 System.out.println(s); break; }else{//a는 총조각 1아니면 a-1/s+1 a--;//1조각 -1빼고 s++;//1조각 +1카운터 } } in.close(); } }
링크
https://www.acmicpc.net/problem/2163
'알고리즘 문제풀이 > 백준(자바)' 카테고리의 다른 글
[java]백준 그대로 출력하기 2 11719번 (0) 2023.05.06 [java]백준 입실 관리 5524번 (0) 2023.05.05 [java]백준 단어의 개수 1152번 (0) 2023.05.03 [java]백준 몇개고? 27294번 (0) 2023.05.02 [java]백준 소수 찾기 1978번 (0) 2023.05.01