목록algorithm (26)
남극

문제 자체는 쉬운 편이지만 메모리를 효율적으로 다루는 것이 좋은듯합니다. 가장 밑부터 소스코드를 올리겠습니다. scanner 사용 시 import java.io.IOException; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] list = new int[n]; for (int i = 0; i < n; i++) { list[i] = sc.nextInt(); } A..
algorithm
2020. 2. 20. 09:59
Baekjoon1110 (java)
import java.util.Scanner; public class Baekjoon1110 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); sc.close(); int num = a; int cnt = 0; do { num = num % 10 * 10 + (num / 10 + num % 10) % 10; cnt++; } while (a != num); System.out.println(cnt); } }
algorithm
2020. 2. 20. 08:26