Written by
java-style
on
on
백준 5397 - 키로거
백준 5397 - 키로거
https://www.acmicpc.net/problem/5397
★ 풀이
예전에 비슷한 형식의 문제를 풀어본 경험이 있어 빠르게 풀 수 있었다.
stack 2개를 만들고 각각 커서의 왼쪽과 오른쪽에 있는 수들로 상정하고 구현하면 쉽게 풀 수 있다.
★ 소스 코드
import java.io.*; import java.util.*; public class Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); public static void main(String[] args) throws IOException { int T = Integer.parseInt(br.readLine()); while(T-->0) { String input = br.readLine(); Stack left = new Stack(); Stack right = new Stack(); for(int i = 0; i
"); } bw.flush(); } }
from http://sweet-smell.tistory.com/85 by ccl(A) rewrite - 2021-11-15 21:27:28