File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ import java .io .*;
2+
3+ class Solution
4+ {
5+ public static void main (String args []) throws Exception
6+ {
7+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
8+ int n = Integer .parseInt (br .readLine ());
9+
10+ if (n ==0 ) System .out .println ("0" );
11+ else if (n %2 ==0 ) System .out .println ((n /2 ) * (n +1 ));
12+ else System .out .println ((n /2 )*(n +1 )+(n /2 +1 ));
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ # [ D1] N줄덧셈 - 2025
2+
3+ [ 문제 링크] ( https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5QFZtaAscDFAUq )
4+
5+ ### 성능 요약
6+
7+ 메모리: 22,528 KB, 시간: 82 ms, 코드길이: 395 Bytes
8+
9+ ### 제출 일자
10+
11+ 2025-09-24 16:38
12+
13+
14+
15+ > 출처: SW Expert Academy, https://swexpertacademy.com/main/code/problem/problemList.do
You can’t perform that action at this time.
0 commit comments