SWEA 1225 (S/W 문제해결 기본) 7일차 - 암호생성기

1 개요[ | ]

SWEA 1225 (S/W 문제해결 기본) 7일차 - 암호생성기
SW Expert 아카데미
# 문제 풀이

틀:SWEA 난이도 3-7

2 C++[ | ]

3 Java[ | ]

import java.util.*;
public class Solution {
	static Scanner sc  = new Scanner(System.in);
	static Queue<Integer> q;
	static void rotate() {
		while(true) {
			for(int i=1; i<=5; i++) {
				int num = q.poll()-i;
				if( num < 1 ) {
					q.add(0);
					return;
				}
				q.add(num);
			}
		}
	}
	public static void main(String[] args) {
		for(int tc=1; tc<=10; tc++) {
			sc.next();
			q = new ArrayDeque<Integer>();
			for(int i=0; i<8; i++) q.add(sc.nextInt());
			rotate();
			System.out.format("#%d %s\n", tc, q.toString().replace(",","").replace("[","").replace("]",""));
		}
		sc.close();
	}
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}