항해 16

99클럽 코테 스터디 16일차 TIL - 프로그래머스 신고 결과 받기

#include using namespace std; vector solution(vector id_list, vector report, int k) { vector answer; map reportList; map reportUser; set temp; for(string id : id_list){ reportList.insert(pair(id, temp)); reportUser.insert(pair(id, 0)); } for(string s: report){ stringstream ss(s); string x, y; ss >> x >>y; set name = reportList.at(x); name.insert(y); reportList.erase(x); reportList.insert(pair(x,..

99클럽 코테 스터디 14일차 TIL - 프로그래머스 JadenCase 문자열 만들기

공백문자가 연속으로 나올 수 있고 맨 앞이나 뒤에도 나올 수 있기 때문에 처음에 그냥 split 메서드 이용해서 푸니까 런타임 에러 발생 StringTokenizer 이용 String s= "this-is-sentence"; StringTokenizer st = new StringTokenizer(s, "-", true); while(st.hasMoreTokens()){ System.out.println(st.nextToken()); } /*** this - is - sentence ***/ import java.io.*; import java.util.*; class Solution { public String solution(String s) { String answer = ""; //String s..

99클럽 코테 스터디 13일차 TIL - 백준 15654 (N과 M (5))

import java.awt.*; import java.util.*; import java.io.*; public class Main { static int N; static int S; static ArrayList list = new ArrayList(); static int[] re; static int[] arr; static boolean[] vi; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); N = I..

99클럽 코테 스터디 11일차 TIL - 백준 14888 (연산자 끼워넣기)

백트래킹으로 모두 탐색... -> 최소값 찾기 import java.awt.*; import java.util.*; import java.io.*; public class Main { static int N; static int[] num; static int[] operator; static int max = Integer.MIN_VALUE; static int min = Integer.MAX_VALUE; static Queue q = new LinkedList(); public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));..

99클럽 코테 스터디 10일차 TIL - 프로그래머스 이진 변환 반복하기

내가 푼 코드 import java.util.*; import java.io.*; class Solution { public int[] solution(String s) { int[] answer = new int[2]; Queue q = new LinkedList(); int changeNum = 0; int zeroNum = 0; while(!s.equals("1")){ zeroNum += s.length()-s.replaceAll("0","").length(); s = s.replaceAll("0",""); int len = s.length(); if(len==1) break; while(len>0){ if(len%2==0){ q.add("0"); len/=2; continue; }if(len%2=..