본문 바로가기

전체 글72

[백준 1193] 분수찾기 이번 코드는 올리기 좀 쪽팔리네요 public class Q1193 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int num = in.nextInt(); int m = 0; int k = 0; for(int i=1; i=num) { k=m-i; m=i; break; } } int[] arr = new int[2]; if(m%2!=0) { arr[0]=m; arr[1]=1; }else { arr[0]=1; arr[1]=m; } int loopCnt = num - k; for(int i=1; i 2019. 4. 2.
[프로그래머스] 프린터 큐를 사용해 푸는 문제입니다 public class PrinterQueue { public static void main(String[] args) throws IOException{ int[] arr = new int[] {1, 1, 9, 1, 1, 1}; int location = 0; PrinterQueue pq = new PrinterQueue(); int result = pq.solution(arr, location); System.out.print("RESULT:"+result); } public int solution(int[] arr, int location) { int answer = 1; Queue queue = new LinkedList(); for(int i=0; i 2019. 4. 2.
[백준 11866] 조세퍼스 문제 0 큐를 사용해 문제를 해결했습니다 public class Q11866 { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int k = Integer.parseInt(st.nextToken()); Queue q = new LinkedList(); for(int i=1; i 2019. 4. 1.
[백준 1065] 한수 출처 : https://www.acmicpc.net/problem/1065 소스코드 public class Q1065 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); // 1 2019. 1. 29.