본문 바로가기
알고리즘 & 자료구조/백준

백준 2675

by 신재권 2021. 7. 14.
import java.util.Scanner;


public class Main2675 {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int T = s.nextInt();
		String[] S = new String[T];
		String[] P = new String[T];
		
		for(int i=0; i<T; i++)
			P[i] = "";
		
		Loop1 : for(int i=0; i<T; i++){
			int R = s.nextInt();
			S[i] = s.next();
			for(int j=0; j<S[i].length(); j++){
				if(!isQRCode(S[i].charAt(j)))
					break Loop1;
			}
			for(int j=0; j<S[i].length(); j++){
				for(int k=0; k<R; k++){
					P[i] = P[i]+ S[i].charAt(j);
				}
			}
		}
		
		for(int i=0; i<T; i++){
			System.out.println(P[i]);
		}
		

		
	}

	public static boolean isQRCode(char c){
		return (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || (c == '\\')
				||(c== '$') || (c == '%') || (c == '*') || (c== '+') || (c == '-')
				||(c == '.') || (c == '/')|| (c == ':');
	}
}

'알고리즘 & 자료구조 > 백준' 카테고리의 다른 글

백준 1152  (0) 2021.07.14
백준 1157  (0) 2021.07.14
백준 10809  (0) 2021.07.13
백준 11720  (0) 2021.07.13
백준 11654  (0) 2021.07.10