일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
- Implemention
- 코드엔진
- 문자열
- 정리
- 백준
- 꾸준히
- VS
- 설명
- CSS
- 10807
- 초보
- 10926
- 그리디
- C
- 입문
- c언어
- C Programming
- Baekjoon
- implement
- 구현
- C 언어
- 파이썬
- 문제풀이
- 심화1
- Beakjoon
- 알고리즘
- 친절한 설명
- HTML
- greedy
- Python
- Today
- Total
목록초보 (89)
안경잡이 구루루
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/dyIZZ2/btqFaUNRVxB/V5SYsEeeL7cmskIPr6lCc1/img.png)
나: def solve(a): ans = sum(a) return ans 완성된 코드는 위와 같다. 위 문제를 보면 입력값으로 받는 a는 list라고 알려주고 있다. 즉 n개의 정수를 갖고 있는 리스트의 총 합을 구하면 된다. sum 함수를 이용해서 리스트의 총합을 ans에 대입하고 이것을 return 으로 출력한다. 다른사람: https://claude-u.tistory.com/107 def solve(num_list): result = 0 for num in num_list: result += num return result 완성된 코드는 위와 같다. 살펴봐야 될 부분은 sum함수 대신에 for 반복문을 이용해서 입력값으로 받은 num_list에 들어있는 요소들의 합을 하나씩 result에 더해나갔다.
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/biUQ8L/btqE7PMXRfz/F8hG9mjDoqjIQ5N57TS6S0/img.png)
나(오답): #include int main() { int a, b, c, mul,lum,cnt=0; char num[10] = { 0, }; scanf_s("%d\n %d\n %d",&a,&b,&c); mul = a * b * c; while (mul > 0) { mul /= 10; cnt++; } for (int i = 0; i < cnt; i++) { lum = mul % 10; num[lum] += 1; mul = mul / 10; } for (int j = 0; j < 10; j++) { printf("%d\n", num[j]); } } 오답인 코드는 다음과 같다. 숫자들을 최종으로 곱한 값 mul의 길이만큼 for 반복을 이용해 나머지값들을 배열의 각 자리에 1씩 더한다고 생각 그러나 결과값은..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bDANYP/btqE7oaBMPK/IjiAcfsKvuuAzKdrZgMpNK/img.png)
나: C = int(input()) for i in range(C): score = list(map(int, input().split())) cnt =0 if score[0] == len(score)-1: aver = (sum(score)-score[0]) / score[0] for j in range(1,len(score)): if aver < score[j]: cnt +=1 print('%0.3f%%'%((cnt/score[0])*100)) 완성된 코드는 위와 같다. C = int(input()) for i in range(C): score = list(map(int, input().split())) cnt =0 if score[0] == len(score)-1: aver = (sum(score)-s..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/SzLzz/btqE6kT5W1x/1KnRALJsNDSLOeE2SKoiQK/img.png)
나: N = int(input()) for i in range(N): OX= input() OX= OX.upper() score =0 plus =1 for k in range(len(OX)): if OX[k] == 'X': plus =1 score +=0 elif OX[k] == 'O': score += plus plus +=1 print(score) 완성된 코드는 위와 같다. N = int(input()) for i in range(N): OX= input() OX= OX.upper() score =0 plus =1 우선 OX 문자열을 몇개 만들지 N을 통해 입력값을 받는다. for 반복문을 만들고 이때 N개수만큼 반복하며 OX 문자열을 받는다. 입력 예시를 보니 모두 대문자이기 때문에 upper 사용..