Problem Solving77 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 ··· 4 5 6 7 다음