코딩테스트/프로그래머스
연속된 수의 합 (c++)
shin0112
2024. 1. 16. 02:32
sol
1. 연속된 수의 합 공식 구하기
[x, x + 1, ... , x + num - 1] → 총 num개의 수
nx + ∑i = nx + n(n + 1)/2
2. total 찾을 때까지 for 문 반복
shin0112/programmers_cpp: programmers' coding test solutions (github.com)
출처 : 프로그래머스 코딩 테스트 연습 -연속된 수의 합
https://school.programmers.co.kr/learn/courses/30/lessons/120923