Recent Posts
Notice
No Rules Rules
합 (feat. 백준, 8393번) 본문
728x90
반응형
합
https://www.acmicpc.net/problem/8393
8393번: 합
n이 주어졌을 때, 1부터 n까지 합을 구하는 프로그램을 작성하시오.
www.acmicpc.net
반응형
// woohyeon.kim
// kim519620.tistory.com
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false), cin.tie(NULL);
register int N, ans = 0;
cin >> N;
for (register int i = 1; i <= N; ++i)
ans += i;
cout << ans;
return 0;
}
// *&)*@*
1부터 입력된 정수까지 +1씩 증가시키며 누적합 결과를 출력하는 문제입니다.
728x90
반응형
'생활 > 코테' 카테고리의 다른 글
빠른 A+B (feat. 백준, 15552번) (0) | 2022.08.10 |
---|---|
영수증 (feat. 백준, 25304번) (0) | 2022.08.10 |
A+B - 3 (feat. 백준, 10950번) (0) | 2022.08.09 |
구구단 (feat. 백준, 2739번) (0) | 2022.08.09 |
주사위 세개 (feat. 백준, 2480번) (0) | 2022.08.09 |
Comments