Language/Algorithm28 Number Reversal Prime Check Example Input : 9 32 55 62 20 250 370 200 30 100 Output : 23 2 73 2 3 My answer : import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class NumberReversal { public static void main(String[] args) { NumberReversal t = new NumberReversal(); Scanner kb = new Scanner(System.in); int n = kb.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = kb.nextIn.. 2023. 12. 13. Prime Number Count Example Input : 20 Output : 8 My answer : import java.util.Scanner; class PrimeNumberCounter { public static void main(String[] args) { PrimeNumberCounter t = new PrimeNumberCounter(); Scanner kb = new Scanner(System.in); int n = kb.nextInt(); System.out.println(t.solution(n)); } int solution(int n) { int answer = 0; int[] tmp = new int[n]; for(int i = 0; i < n; i++) { tmp[i] = i + 1; } for(int .. 2023. 12. 12. Fibonacci series Example Input : 10 Output : 1 1 2 3 5 8 13 21 34 55 My answer: import java.util.*; class FibonacciSeriesGenerator { public static void main(String[] args) { FibonacciSeriesGenerator t = new FibonacciSeriesGenerator(); Scanner kb = new Scanner(System.in); int n = kb.nextInt(); for(int i : t.solution(n)) { System.out.print(i + " "); } } List solution(int n) { List answer = new ArrayList(); answer... 2023. 12. 7. Rock Paper Scissors Game Example Input : 5 2 3 3 1 3 1 1 2 2 3 Output : A B A B D ( 1 : Scissors , 2 : Rock , 3 : Paper ) My answer : import java.util.Scanner; class RockPaperScissorsGame { public static void main(String[] args) { RockPaperScissorsGame t = new RockPaperScissorsGame(); Scanner kb = new Scanner(System.in); int n = kb.nextInt(); int[] A = new int[n]; int[] B = new int[n]; for(int i = 0; i < n; i++) { A[i] .. 2023. 12. 6. 이전 1 2 3 4 5 6 7 다음