분류 전체보기104 1-8. 소수 만들기 (프로그래머스 Summer/Winter coding 2018) #include #include using namespace std; int solution(vector nums) { int answer = 0; int flag = 0; for(int i=0 ; i 2021. 7. 7. 1-7. 블라인드 (백준 2799) #include using namespace std; int main(){ int M,N; int answer[5] = {0}; cin >> M; cin >> N; string arr[5*M + 1]; for(int i=0 ; i > arr[i]; } for(int i=0 ; i 2021. 7. 7. 1-6. Pascal's Triangle (LeetCode 118) class Solution { public List generate(int numRows) { List biglist = new ArrayList(); for(int i = 0 ; i < numRows ; i++) biglist.add(new ArrayList()); biglist.get(0).add(1); if(numRows == 1) return biglist; else{ for(int i = 1 ; i < numRows ; i++){ biglist.get(i).add(1); for(int j = 0 ; j < i-1 ; j++){ biglist.get(i).add( biglist.get(i-1).get(j) + biglist.get(i-1).get(j+1) ); } biglist.get(i).add.. 2021. 7. 7. 1-5. Plus One (LeetCode 66) class Solution { public int[] plusOne(int[] digits) { int[] answer = new int[digits.length + 1]; digits[digits.length - 1] += 1; for(int i = 1 ; i 2021. 7. 7. 1-4. 평균은 넘겠지 (백준 4344) #include using namespace std; int main(){ int nt; float sum=0, count=0; int n; cin >> nt; cout > n; int tmp[n]; count = 0; for(int j = 0 ; j > tmp[j]; sum += tmp[j]; } for(int j = 0 ; j < n ; j++){ if( sum/n < tmp[j]) count++; } cout 2021. 7. 7. 1-3. Assign Cookies (LeetCode 455) class Solution { public int findContentChildren(int[] g, int[] s) { int answer = 0; int G=0,S=0; Arrays.sort(g); Arrays.sort(s); while(G < g.length && S < s.length ){ if(g[G] 2021. 7. 7. 1-2. 스킬트리 (프로그래머스 summer/winter coding 2018) #include #include using namespace std; int solution(string skill, vector skill_trees) { int snum[ 26 ]; int answer = 0, flag = 0; string s; if(skill.size() == 1 ) return skill_trees.size(); for(int i = 0 ; i < skill_trees.size() ; i++){ s = skill_trees[i]; for(int j = 0 ; j < skill.size() ; j++){ if( s.find( skill[j] ) != string::npos ) snum[j] = s.find( skill[j] ); else snum[j] = skill.size()*2.. 2021. 7. 7. 1-1. 음계 판별하기 (백준 2920) #include using namespace std; int main(){ int a[8]; for(int i = 0 ; i > a[i]; if(a[0] == 1){ for(int i = 1 ; i < 8 ; i++){ if(a[i] != ( a[i-1] + 1 ) ) { cout 2021. 7. 7. 이전 1 ··· 6 7 8 9 다음