2018년 11월 9일 금요일

괄호 검사 기본문제

괄호검사를 하는 알고리즘
- stack으로 해결

package test2;
import java.util.Scanner;
import java.util.Stack;
public class Main {
 static int tree[][];
 static int t[][];
 static int n;
 static int check[];
 public static void main(String[] args) {
   
  Stack<Character> st = new Stack<Character>();
  Scanner sc = new Scanner(System.in);
 
  String temp = sc.next();
 
  for(int i=0;i<temp.length();i++) {
   if(temp.charAt(i)=='(')st.push('(');
   else {
    if(st.isEmpty()) {
     System.out.println("false");
     return;
    }
    st.pop();
   }
  
  }
  if(st.isEmpty())
  System.out.println("true");
  else System.out.println("false");
 
 
 
 }

}

flutter 기본 개념 1

  Scaffold  - 화면 뼈대 역할  - 기본적으로 AppBar body floatingActionButton 같은걸 배치해줌  return Scaffold (       appBar : AppBar ( title : const Text ...