Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 파이썬
- database
- Method
- Tree
- Binary Search
- greedy
- Data Structure
- Binary Tree
- 구현
- two pointers
- simulation
- Stack
- bit manipulation
- geometry
- java
- dynamic programming
- Math
- 코딩테스트
- Matrix
- string
- SQL
- Number Theory
- hash table
- Class
- 자바
- implement
- array
- Counting
- 코테
- sorting
Archives
- Today
- Total
코린이의 소소한 공부노트
[프로그래머스/Lv.1] 약수의 합 본문
1. Input
1) 정수 n
2. Output
1) n의 약수를 모두 더한 값
3. Constraint
1) n은 0 이상 3,000 이하인 정수
4. Example
Input: n=12 -> Output: 28
설명: 1 + 2 + 3 + 4 + 6 + 12 = 28
5. Code
1) 첫 코드(2022/??)
int answer = 0;
for(int i=1 ; i<=n ; i++)
if(n%i == 0) answer += i;
return answer;
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[프로그래머스/Lv.1] 문자열을 정수로 바꾸기 (0) | 2022.11.25 |
---|---|
[프로그래머스/Lv.1] 시저 암호 (0) | 2022.11.25 |
[프로그래머스/Lv.1] 이상한 문자 만들기 (0) | 2022.11.25 |
[프로그래머스/Lv.1] 자릿수 더하기 (0) | 2022.11.25 |
[프로그래머스/Lv.2] 최솟값 만들기 (0) | 2022.11.24 |